- Set up authentication so that only a request with a JWT can access the dashboard
- After a user signs up they log in and are given a signed JWT
- Only registered users should be able to obtain a JWT
When logging in, the app looks for the username and password. If both the username and password exist, then it will create a new signed JWT. Otherwise, an error is returned. Upon successful creation of the JWT, the user will be notified.
The main endpoints, and correct URL with correct paths are:
http://localhost:3000/api/v1/dashboard
http://localhost:3000/api/v1/login
- Check that the package versions in package.json are the most recent
- Edit the package.json file accordingly before running the npm install command
- Once all that is done, run the following commands
- Install the packages and Express for API development
npm install --save express
- Install nodemon it's a development package. It auto runs the server.
npm install --save-dev nodemon
- Edit
package.json
to make running the server easier. Add this to thepackage.json
file
"start": "nodemon.js"
- Install a parser to parse incoming request bodies
npm install --save body-parser
Run the commands listed above in the console of your IDE, (I used Jet Brains WebStorm). Then open a browser and navigate to http://localhost:3000
For more information, please refer to the WebStorm Documentation