https://github.com/eperezcosano/auth-server-template
A basic template for a server token authorization
https://github.com/eperezcosano/auth-server-template
express jwt jwt-auth jwt-server mongodb mongoose nodejs
Last synced: 2 months ago
JSON representation
A basic template for a server token authorization
- Host: GitHub
- URL: https://github.com/eperezcosano/auth-server-template
- Owner: eperezcosano
- License: mit
- Created: 2021-10-29T12:40:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-18T19:29:56.000Z (almost 3 years ago)
- Last Synced: 2023-07-18T20:36:30.338Z (almost 3 years ago)
- Topics: express, jwt, jwt-auth, jwt-server, mongodb, mongoose, nodejs
- Language: JavaScript
- Homepage:
- Size: 94.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# API Server JWT Auth
A basic template for a server token authorization
## Models
### User
| Parameter | Type | Description |
|:----------|:-------|:--------------|
| email | string | User e-mail |
| pass | string | User password |
## Routes
| Method | Auth | Path | Description | Body JSON |
|:------:|------|------------------|---------------------|-------------------------------------------------------------------|
| GET | | / | "Hello World" | |
| POST | | /register | Create a new user | [User](https://github.com/eperezcosano/auth-server-template#user) |
| POST | | /login | Generates a new JWT | [User](https://github.com/eperezcosano/auth-server-template#user) |
| GET | JWT | /validate | Validate JWT | |
| GET | JWT | /dashboard/ | Protected route | |
| GET | JWT | /dashboard/users | Get all users | |
## Installation
Install dependencies:
```
npm i
```
Add .env file:
```
MONGO_URI=
PORT=
JW_SECRET=
JW_EXPIRATION=
```
Run node project:
```
node index.js
```
## Technologies
- node.js
- express
- mongoose
- jwt
## Author Info
Izan Pérez Cosano (https://github.com/eperezcosano)