Code Monkey home page Code Monkey logo

goto's Introduction

Goto

codecov

Goto is a service designed to shorten URLs.
It is an HTTP API server which stores data in-memory and can optionally persist it to disk.

2 clients are available for it, a front-end web interface and a CLI tool.

Example usage

Server

cargo run

# or

cargo build --release
target/release/goto-api

Same thing, but with some options:

cargo run -- --addr 127.0.0.1:8080 --database ./database.yml --frontdir front/dist/

Use cargo run -- --help for available options and their description.

Clients

CLI tool

CLI tool demo

Build it yourself

make build-cli # build for release and move to /usr/local/bin/goto
goto --version

# OR

cargo build --bin goto
target/debug/goto --version

The first time you run the CLI, it will create its configuration at $HOME/.goto/config.yml. Feel free to edit it to change the defaults!

Use it

# show available options
goto --help

# create a new short URL
goto hello http://world

# browse this url, it will automatically open your web browser
goto hello

# display the URL but don't browse it
goto hello --no-open-browser

Clean-up

rm /usr/local/bin/goto
rm -rf $HOME/.goto

Web Front-End

Front-end Demo

The front-end is designed to be served by the API, so make sure to have the API started and running.

$ cd front/
$ make build

# it is now ready to be served by the API
$ echo http://127.0.0.1:8080/

You can of course host the front-end somewhere else if you want.

HTTP Client

You can also directly query the API with any HTTP client.

# create a new shortened URL
$ curl -X POST 127.0.0.1:8080/tsauvajon -d "https://linkedin.com/in/tsauvajon"
/tsauvajon now redirects to https://linkedin.com/in/tsauvajon

# browse it
$ curl 127.0.0.1:8080/tsauvajon
redirecting to https://linkedin.com/in/tsauvajon...

goto's People

Contributors

tsauvajon avatar dependabot[bot] avatar

Stargazers

Suraj Biyani avatar Dmitry Ivanov avatar  avatar MushuLeDragon avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.