This is a Node.js REST API demo project to explore concepts like authentication, salting, controllers, schemas, session tokens, routing, middleware and restful APIs. Features include creating, updating, deleting and authenticating users.
Setup an .env file like this:
SECRET = [YOUR_SECRET]
MONGO_URL = [YOUR_MONGODB_URL]
You can run the api locally with:
npm run start
POST /auth/register
{
"email": "[email protected]",
"password": "1234",
"username": "Caesar"
}
POST /auth/login
{
"email": "[email protected]",
"password": "1234",
"username": "Caesar"
}
GET /users (gets all users but you have to be logged in)
DEL /users/:id (deletes your user but you have to be logged in)
PATCH /users/:id
{
"username": "Quintus"
}