https://github.com/cba85/express-fake-token-auth-api
🥸 A fake Token Authentication API using Express.js (node).
https://github.com/cba85/express-fake-token-auth-api
api express fake nodejs token-based-authentication
Last synced: 2 months ago
JSON representation
🥸 A fake Token Authentication API using Express.js (node).
- Host: GitHub
- URL: https://github.com/cba85/express-fake-token-auth-api
- Owner: cba85
- Created: 2023-04-12T14:44:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-12T14:54:32.000Z (about 3 years ago)
- Last Synced: 2025-03-11T21:44:27.542Z (over 1 year ago)
- Topics: api, express, fake, nodejs, token-based-authentication
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Express Fake Token Auth API
A fake Token Authentication API using Express.js (node).
This API just check the format of parameters but don't check their values.
It means you can use any username, email, password and bearer token.
## Install
```sh
$ npm install
```
## Usage
```sh
$ npm run dev
```
## Routes
### Home
```sh
GET /
```
#### Responses
| Status Code | Description |
| --- | --- |
| 200 | OK |
HTML
### Login
```sh
POST /login
```
#### Request Body
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `email` | `string` | **Required**. **Valid email**. Email address |
| `password`| `string` | **Required**. **Min length: 8** Password |
#### Responses
| Status Code | Description |
| --- | --- |
| 200 | OK |
Object
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `id` | `integer` | User ID |
| `username` | `string` | Username |
| `email`| `string` | User email address |
| `token` | `string` | Authentication token |
#### Errors
| Status Code | Description |
| --- | --- |
| 401 | Unauthorized |
| 422 | Unprocessable Entity |
### Register
```sh
POST /register
```
#### Request Body
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `username` | `string` | **Required**. Username |
| `email` | `string` | **Required**. **Valid email**. Email address |
| `password`| `string` | **Required**. **Min length: 8** Password |
#### Responses
| Status Code | Description |
| --- | --- |
| 201 | Created |
Object
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `id` | `integer` | User ID |
| `username` | `string` | Username |
| `email`| `string` | User email address |
| `token` | `string` | Authentication token |
#### Errors
| Status Code | Description |
| --- | --- |
| 422 | Unprocessable Entity |
### Me
```sh
GET /me
```
#### Request headers
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `Authorization` | `string` | **Required**. Bearer token |
#### Responses
| Status Code | Description |
| --- | --- |
| 200 | Ok |
Object
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `id` | `integer` | User ID |
| `username` | `string` | Username |
| `email`| `string` | User email address |
| `token` | `string` | Authentication token |
#### Errors
| Status Code | Description |
| --- | --- |
| 401 | Unauthorized |
| 422 | Unprocessable Entity |
### Logout
```sh
POST /logout
```
#### Request headers
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `Authorization` | `string` | **Required**. Bearer token |
#### Responses
| Status Code | Description |
| --- | --- |
| 204 | No Content |
#### Errors
| Status Code | Description |
| --- | --- |
| 401 | Unauthorized |
| 422 | Unprocessable Entity |