The boring mock API to redeem weekly rewards.
This boring mock API is built with Express.js
. The maintainer of this repo keeps the number of dependencies to a minimum. We only need node-cache
to store response in-memory, jest
for test suites, and supertest
to mock API request.
You only need the latest (or decent) version of Node.js
installed in your machine. That's it.
Install all dependencies:
$ npm install
After that, run this command:
$ npm run start
Hit localhost:3000
to see the result.
Here's the available endpoints:
- GET
localhost:3000/users/:userId
. - GET
localhost:3000/users/:userId/rewards?at={ISO 8061 date string format}
. - PATCH
localhost:3000/users/:userId/rewards/:rewardId/redeem
.
To test them all, run this command:
$ npm run test