Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

brenobaldassim/node-rest-api-authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[PORTIFOLIO] - Node.JS Rest API with User Authentication

To run the API

  1. Clone the project git clone ${project_url}
  2. Install the dependencies with npm npm install
  3. Set the enviroment variables on .env such as the .env-example file
  4. Create a database cluster on MongoDB Atlas and add the connection string to the MONGO_CLUSTER at the enviroment variables. Add the User and Password to MONGO_USER_ADMIN and MONGO_PASSWORD as well.
  5. Run npm start at terminal

Note: The Database will start unseeded and unfortunately for now I do not have a seeded db to provide.

Docs

[POST] /auth/register

Requisition:

Expected body:
{
"email": "string",
"password": "string",
"username": "string"
}

Response:

Expected body:
{
"username": "string",
"email": "string",
"authentication": {
"password": "string",
"salt": "string"
},
"_id": "hex64",
"__v": 0
}

[POST] /auth/login

Requisition:

Expected body:
{
"email": "string",
"password": "string",
}

Response:

Expected body:
{
"authentication": {
 "password": "string",
 "salt": "string"
},
"_id": "hex64",
"username": "string",
"email": "string",
"__v": 0
}

[GET] /users

Requisition:

Expected body:
{}

Response:

Expected body:
[
  {
    "_id": "hex64",
    "username": "string",
    "email": "string",
    "__v": 0
  },
  {}...
]

[DELETE] /users/:id

Requisition:

Expected body:
{}

Response:

Expected body:
  {
    "_id": "hex64",
    "username": "string",
    "email": "string",
    "__v": 0
  },

[PATCH] /users/:id

Requisition:

Expected body:
{
 "username": "string",
}

Response:

Expected body:
  {
    "_id": "hex64",
    "username": "string",
    "email": "string",
    "__v": 0
  },

About

A node CRUD API with user athentication that implements typescript, express and MongoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published