URL Shortener - Werval Sample Application
The URL Shortener sample implement an extremely simple HTTP API using GET methods only and outputing JSON documents. The shortened URLs are stored in-memory, not persisted. They do not survive an application restart.
URL Shortener is implemented using the Hashids implementation included in werval.
A simple page served at
/ allow you to play with the API using HTML forms.
You'll find bellow the various httpie commands you can use to use the HTTP API.
- List all shortened urls:
- Shorten a given url:
- Expand a url given its hash:
- Lookup existing short url for a given one:
- Open shortened url, get redirection:
This is the simplest sample and it is intended to be so.
It demonstrate the following:
- defining routes,
- basics of controller implementation,
- basics of Global object usage.
Whatever would be your Werval usage, you are encouraged to read this sample code.
To run in development mode:
To run in production mode:
To run tests:
To build a production distribution:
To see all available tasks: