An Express/MongoDB based REST API with Passport token authentication.
- MongoDB instance
yarn install
MONGO_URI='mongodb://user:pass@hostname:27017/db' yarn start
Navigate to http://hostname:3000/ and confirm you receive the below response:
{"message":"Connected!"}
You must first register, then login to receive the token which you can then use for the other endpoints. You only need to call login with user/pass if already registered.
POST {name: nameVALUE, username: userVALUE, password: passVALUE}
to /auth/register
POST {username: userVALUE, password: passVALUE}
to /auth/login
Save the token from the response object
{token}
as it will be needed for all other api calls
This API requires you to set header: authorization for each request to the JWT token received from 'login'
GET /users
GET /users/:userID
POST /users/:userID
DELETE /users/:userID