๐ป Login Template
A simple login and register template with Node Js
๐ Project status
Project finished and ready to use
๐ Project task list
- โ Folder Structures
- โ JWT & Errors Middleware
- โ User Controller
- โ API Routing
- โ User Model
- โ User Service
- โ API Testing
โ Run Locally
Clone the project
git clone https://github.com/marioperdiguero/Login-Template.git
Go to the project directory
cd my-project
Install dependencies
npm install
Create a folder at the root of the project called config. Then, inside that folder create a file called "db.config.js", and inside the file paste the following code:
module.exports = {
db: 'your MongoDB connection string will go here'
}
Start the server
npm run start
๐ API Reference
Register New User
POST /users/register
Http Body:
Parameter | Type | Description |
---|---|---|
username |
string |
Required. The user name |
password |
string |
Required. The user password |
email |
string |
Required. The user email |
Login User
POST /users/login
Http Body:
Parameter | Type | Description |
---|---|---|
username |
string |
Required. The user name |
password |
string |
Required. The user password |
Example of page protected by authentication
GET /users/user-profile
Http Headers:
Parameter | Type | Description |
---|---|---|
Authorization |
string |
Required. Basic + JWT Token of user |