https://github.com/shahfh/node.js-api-authentication-with-jwt
Node.js-API-Authentication-with-JWT
https://github.com/shahfh/node.js-api-authentication-with-jwt
api expressjs jwt-authentication mongodb mongoose nodeapiwithjwttoken nodejs password-hashing
Last synced: about 1 year ago
JSON representation
Node.js-API-Authentication-with-JWT
- Host: GitHub
- URL: https://github.com/shahfh/node.js-api-authentication-with-jwt
- Owner: ShahFH
- Created: 2023-07-18T07:12:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-04T17:46:05.000Z (over 2 years ago)
- Last Synced: 2025-01-13T20:39:31.058Z (about 1 year ago)
- Topics: api, expressjs, jwt-authentication, mongodb, mongoose, nodeapiwithjwttoken, nodejs, password-hashing
- Language: JavaScript
- Homepage:
- Size: 5.27 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js Authentication API
This repository contains a Node.js API that provides authentication functionality for use in various applications. The API utilizes JWT (JSON Web Tokens) for authentication and MongoDB as its database. It also incorporates Mongoose to create models and connect to the Express server, bcryptjs for password hashing, and jwt to secure private routes.
## Technologies Used ⚙
- Node.js
- Express.js
- MongoDB
- Mongoose
- bcryptjs
- JSON Web Tokens (JWT)
## Installation ⚒
1. Clone the repository to your local machine using git clone URL
2. Install the required dependencies: npm install
3. Set up the MongoDB connection:
```
Make sure you have MongoDB installed and running.
Edit the config.js file to specify your MongoDB connection URL.
```
## Usage
To start the server, use the following command:
npm start
The server will be running at http://localhost:3000 by default. You can change the port by modifying the PORT constant in the index.js file.
## Endpoints
The following API endpoints are available:
```"copy"
POST /api/user/login
POST /api/user/register
```
Feel free to use, modify, and distribute this code as per the terms of the MIT License. However, please note that this project comes with no warranties. Use it at your own risk.