This is a REST API that uses express.js
for simple questions and answers submissions. The data is stored in the file questions.json
. Initially, just a first few API endpoints are implemented. The goal of this exercise is to create and test the rest of the endpoints.
The solution is a basic skeleton of express.js
app:
- The starting point is
index.js
- it contains the routes definitions. Most of them are empty and should be implemented as part of solving this exercise. Use theGET /questions
route as a reference. - The
repositories/question.js
holds the data store (which is a simple file, stored on disk) for questions and answers. It also has functions that require implementation. - Ther is also a test file for
question repository
. Put your repository tests there. - The
middleware/repositories.js
hooks a repository into thereq
object ofexpress.js
. No need to extend anything here.
- The structure of questions and answers objects can be deducted from
questions.json
. - The
id
are GUID's (there is alreadyuuid
package added topackage.json
to facilitate their creation - usev4
). - For endpoints that have
id
parameter it will look something like this:
GET /questions/50f9e662-fa0e-4ec7-b53b-7845e8f821c3/answers/d498c0a3-5be2-4354-a3bc-78673aca0f31
Please make sure you write unit tests - part of the exercise is to explore your ability to write them. Also, try to cover all endpoints, however, this is not crucial.
Upload your soultion to either Github or Gitlab and send us the link.