/shorty

Rusty URL Shortener

Primary LanguageRustMIT LicenseMIT

shorty

Build Status

Rusty URL Shortener

Setup

nightly is required for rocket library's features

rustup update
rustup override set nightly

Build & Run

Build:

cargo build

Run tests:

cargo test

Run with docker:

docker-compose up

Run on host:

# install and start redis locally
REDIS_HOST=localhost cargo run

Try it out

Create new short url ID:

$ curl --data "url=https://www.rust-lang.org" http://localhost:8000/
egYb

Lookup a short ID:

$ curl -I http://localhost:8000/egYb
HTTP/1.1 308 Permanent Redirect
Location: https://www.rust-lang.org
Server: Rocket
Content-Length: 0
Date: Tue, 03 Apr 2018 21:15:35 GMT