Implement a small HTTP service to store objects organized by repository. Clients of this service must implement the API below.
We value your time, and ask that you spend no more than 2 hours on this exercise.
- The service should identify objects by their content. This means that two objects with the same content should be considered identical, and only one such object should be stored per repository.
- Two objects with the same content that are in separate repositories should be stored separately.
- The included tests should pass and should not be modified.
- Do not move or rename any of the existing files.
- The service must implement the API as described below.
- The data can be persisted in memory, on disk, or wherever you like.
- Prefer using the standard library over external dependencies. If you must include an external dependency, please explain your choice in the pull request.
- Your code will be read by humans, please take the time to optimize for that.
- Add extra tests to test the functionality of your implementation.
- The description of your submission should be used to describe your reasoning, your assumptions and the tradeoffs in your implementation.
- If your chosen language allows for concurrency, remember that this is a web application and concurrent requests will come in.
- Focus on getting a working solution and avoid external dependencies for data storage.
PUT /data/{repository}
Status: 201 Created
{
"oid": "2845f5a412dbdfacf95193f296dd0f5b2a16920da5a7ffa4c5832f223b03de96",
"size": 1234
}
GET /data/{repository}/{objectID}
Status: 200 OK
{object data}
Objects that are not on the server will return a 404 Not Found
.
DELETE /data/{repository}/{objectID}
Status: 200 OK
This exercise requires a recent version of Node.js. Get started by installing dependencies:
npm install
Write your server implementation in server.js
. Then run the tests:
npm test
Or run them continuously as you work:
npm run test-watch
Once you have a working implementation, open a pull request that includes your changes.
When you are finished:
- Commit all of your code.
- Push your changes to GitHub.
- Open a pull request.
- Visit https://interviews.githubapp.com/ and click
Done
. - Thank you! 🎉