Direct contract to hire

Job ID: 35988879

Budget: $15 – $25 USD

I need 2 talented backend engineers who have a strong experience in Node.js. It is a 3 month contract for MVP and if it goes successful, they will be promoted to 2 year contract in the core team. The following is a simple challenge for Node.js that solid candidates should spend 3 hours to complete. I need to close this offer by Friday (Feb 17) so anybody who is not sure about the deadline should not start.

Build an app server and implement a POST request endpoint (/url) that receives a URL through a parameter called "url". This endpoint will shorten the URL following the rules below:
Generate a random 10 character code that accepts both letters and numbers.
Append the generated code to the server's base URL (localhost or 127.0.0.1).
Associate the above result with the URL sent by the client and persist it (no need to use a database).

After shortening the URL, the server has to return the result to the client, but not through the request's response. Feel free to choose any protocol to achieve this. Be prepared to receive a response back from the client through the same protocol acknowledging that it has received the result. Also consider that the client may randomly not respond (simulation of connection lost state), so if that is the case, the server needs to take any actions necessary to ensure that the result indeed gets delivered to the client.

The client will then be able to make a GET request using the shortened URL and the server will return a JSON with the object "url" containing the original URL.

Example:
Client: POST http://localhost:3000/url params: {"url": "classcalc.com"}
Server generates shortened URL: http://localhost:3000/a2b345w68s
Server: Sends back to the client (not through the above HTTP Request's response) {"shortenedURL": "http://localhost:3000/a2b345w68s"}
Client: GET http://localhost:3000/a2b345w68s
Server: Returns the following response to the GET request above - {"url": "classcalc.com"}
Related categories: JavaScript NoSQL Couch & Mongo Node.js Express JS