Cheat Sheet API allows you to to CRUD operations by exposing the following endpoints:
| Endpoints | Methods | Operation | Public access |
|---|---|---|---|
| /api/user/register | POST | Register a new user | true |
| /api/user/login | POST | Log in user | true |
| /user/cheats | POST | create a new cheat sheet | false |
| /user/cheats | GET | fetch all cheat sheets | false |
| /user/cheats/:cheatId | GET | fetch a single cheat sheet | false |
| /user/cheats/:cheatId | PUT | edit cheat sheet with the argument passed | false |
| /user/cheats/:cheatId | DELETE | delete cheat sheet with the argument passed | false |
To run this Application locally, you will need the following installed:
- Nodejs v10.10.0
- npm v6.4.1
- MongoDB v4.0.2
Git clone to get a copy of the application on your laptop.
git clone https://github.com/Gidraff/cheat-sheet-api.gitRun cd cheat-sheet-api to change directory.
To install application dependencies, run:
npm installTo create a .env file run:
mv .env.sample .envNOTE: Replace the values in .env with your own values
Run unit test to make sure nothing has broken. Make sure mongo daemon is running
npm testBefore running the application, make sure you replace db url string with a running mongodb instance or use the local mongodb.
npm startGidraff(me)