Skip to content
luisf-csdevPublic

About

Backend API REST for Express version of the Login JWT project. Developed with JavaScript, Node.js, Express, MongoDB, JWT, and Docker.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Login API

👾 Backend API REST for Express version of the Login JWT project 🔙


📌 Features

  • Reusable login API REST
  • Express version of Login JWT
  • Unique emails register
  • Encrypted passwords with bcrypt
  • User validated by a token with expiration time
  • Admin-only route also validated by token
  • Provided data validated before being entered into the database

gif-2
gif-2 gif-2
gif-2 gif-2


💾 Prerequisites

You'll need to have a database inside a project on the MongoDB Cloud and connect to obtain the Mongo URI:

Then you'll need to have the following tools installed on your machine:

Also, use your preferred code editor and REST client.

🪢 Clone Repository

# execute the git clone command
git clone https://github.com/luisf-csdev/login-jwt.git

# enter the project folder
cd login-api

# install the dependencies
npm install

# create a .env file in the directory's root with the mongo uri and the secret for your token
MONGODB_URI = your mongodb uri
TOKEN_SECRET = "any set of letters and numbers"

# finally, run the nodemon script
npm run nodemon

# the api will start in port:8080 - access <http://localhost:8080> in your rest client

🛣 Routes

POST

  • /login
  • /register

GET

  • /user
  • /user/admin

✨ JSON

REGISTER

{
"name": "(required)",
"email": "(required)",
"password": "(required)",
"admin": "(false by default)"
}

LOGIN

{
"email": "(required)",
"password": "(required)",
}

💽 Stacks

luisf-react JavaScript luisf-node Node.js luisf-next.js Express luisf-mongo MongoDB luisf-jwt JSON Web Tokens luisf-jwt Docker





Excelsior code 💙 by Luís Felipe

🪐 See my LinkedIn 🪐

About

Backend API REST for Express version of the Login JWT project. Developed with JavaScript, Node.js, Express, MongoDB, JWT, and Docker.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages