rsouza01 / vanhack-url-rzr

URL Shortener

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assignment: URL Shortener Build Status License: MIT

Description

Most of us are familiar with seeing URLs like bit.ly or t.co on our Twitter or Facebook feeds. These are examples of shortened URLs, which are a short alias or pointer to a longer page link. For example, I can send you the shortened URL http://bit.ly/SaaYw5 that will forward you to a very long Google URL with search results on how to iron a shirt.

Mandatory Requirements

  • Design and implement an API for short URL creation
  • Implement forwarding of short URLs to the original ones
  • There should be some form of persistent storage
  • The application should be distributed as one or more Docker images

Additional Requirements

  • Design and implement an API for gathering different statistics

Assessment

Treat this as a real project. It should be readable, maintainable, and extensible where appropriate.

The implementation should preferably be in Java, however any language can be used.

If you will transfer it to another team - it should be clear how to work with it and what is going on.

You should send us a link to a Git repository that we will be able to clone.

Links (References)

Running the project

First, you have to build the project and finally the docker image. Both procedures are inside the file publish-server-mvn.sh. Once the server is running, you can run the tests either by using Postman or runing the run-tests.sh script (curl is a dependency).

API Documentation

Shorten URL

Redirect to URL

  • Endpoint: /{shortenedUrl}
  • Method: GET
  • URL Params(required): shortenedUrl:[string] (example:shortenedUrl=b9a982c)
  • Success response code: 301 (MOVED_PERMANENTLY, redirection)
  • Error response: 404 (url not found)
  • Sample call: curl -i -H "Content-Type: application/json" -X GET http://localhost:8080/b9a982c

Redirect to URL

  • Endpoint: /{statistics}
  • Method: GET
  • Success response code: 200 (SUCCESS)
  • Sample call: curl -i -H "Content-Type: application/json" -X GET http://localhost:8080/statistics

About

URL Shortener


Languages

Language:Java 62.3%Language:Shell 37.7%