Task is to build a small user management service.
- Routes to implement:
- GET /users?id={userId}&phoneNumber={phoneNumber}
- fetch a user matching the query
- if no query params are specified, return all
- POST /users (create a user)
- PATCH /users?id={userId}&phoneNumber={phoneNumber}
- Bulk update users
- Query parameters should work exactly like they do in GET
- DELETE /users?id={userId}&phoneNumber={phoneNumber}
- Note: the the exact implementation (contains, equals, prefix) is up to you. Feel free to add more query parameters you feel would be important
- Note: You have to implement any relevant models to implement the service. You must add the migrations as well
- Note: Ensure you do request validation. Bonus points for response validation too
- Constraints:
- Use NodeJS + Typescript
- You must use the serverless framework
- Use TypeORM as the ORM (be sure to generate and include the migrations)
- Use any SQL based database (including sqlite, this is just a test service)
- An OpenAPI document documenting the service must be present. Preferably, write the document first and generate the models/routes from there
- Use OpenAPI-Backend (https://www.npmjs.com/package/openapi-backend) to auto generate the server, it’s request validation etc.
- OpenAPI Backend must be served over
serverless-offline
- Serverless is hard to test with, use OpenAPI Backend over express to run tests
- Automated unit tests:
- Testing is fundamental to the backend
- Test whether your code actually returns the expected output and only modifies/updates the expected items
- Test whether request validation is happening correctly
- Tests must be written using Jest
- Routes must be tested using supertest
- You will be judged on the following:
- How well abstracted your code is. Negative points for duplicated code
- How quickly you adapt to functional code
- How well written & clean your code is.
- How useful your tests are. Negative points for mindless assertions that don't test for correctness. You must be able to prove your service works through these tests.
- Upon completion. Create a repo on GitHub and send the url to the repo.