👾 Backend API REST for Express version of the Login JWT project 🔙
Features • API Demo • Prerequisites • Clone Repository • Routes • JSON • Stacks • Author
- 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
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.
# 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- /login
- /register
- /user
- /user/admin
{
"name": "(required)",
"email": "(required)",
"password": "(required)",
"admin": "(false by default)"
}{
"email": "(required)",
"password": "(required)",
}



