- Submitted by: Vinh Nguyen
- Time spent: 3 hours
Run on terminal
Go to localhost:8080/dogs or localhost:8080/cats
The list of redirection should be maintained in a command line tool, what can:
- Manipulate YAML config file. Where the redirection list peristently stored.
- Implement append to the list:
./url-shortener configure -a dogs -u www.dogs.com - Implement remove from the list:
./url-shortener -d dogs - List redirections:
./url-shortener -l - Run HTTP server on a given port:
./url-shortener run -p 8080 - Prints usage info:
./url-shortener -h
- Track number of times each redirection is used. When the user uses
urlshorten -l, the user should see redirections ranked by how many times they have been used. - Provide a default shortening, if no example is given. For example, if
dogsis not given, generate a random alphanumeric string of length 8. - Build a Handler that doesn't read from a map but instead reads from a database. Whether you use BoltDB, SQL, or something else is entirely up to you.