
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
mock-user-auth
Advanced tools
Mock-User-Auth is a mock user authentication API developed in Nodejs and Express using JWT as authenticator
Mock-User-Auth is a mock user authentication API developed in Nodejs and Express using JWT as an authenticator in the ES6 version of JavaScript.
The use: It can be used to assist your front-end development. It's simple and fast, you just need to follow the steps below.
Toolkit: Node.js | Express.js | Mocha | Chai | Istanbul
1 - Install package:
$ npm i --save mock-user-auth
2 - Create script in package.json:
{
"script": {
"dev": "nodemon ./node_modules/mock-user-auth/bin/www.js"
}
}
3 - Start api:
$ npm run dev
Option: You can set the port after npm command:
$ npm run dev 8080
Obs.: The following instructions were tested on Ubuntu distribution.
1 - After 'git clone' command, run the following commands to install dependencies:
2 - Start application
Action | Required | Method | URL |
---|---|---|---|
AUTHENTICATE USER | POST | /api/v1/auth | |
CREATE USER | POST | /api/v1/users | |
GET USER | Auth | GET | /api/v1/users |
PATCH USER | Auth | PATCH | /api/v1/users |
DELETE USER | Auth | DELETE | /api/v1/users |
DELETE ALL USERS | DELETE | /api/v1/users |
POST /api/v1/auth
{
"email": "user@gmail.com",
"password": "user123"
}
{
"token": "eyJhbGciOiJI..."
}
POST /api/v1/users
{
"name": "user",
"email": "user@gmail.com",
"password": "user123"
}
{
"message": "User registered with success",
"token": "eyJhbGciOiJI..."
}
GET /api/v1/users
const token = 'eyJhbGciOiJI...';
req.setRequestHeader('Authorization', token);
{
"id": 46643,
"name": "user",
"email": "user@gmail.com",
"password": "user123",
"imageUrl": "https://almsaeedstudio.com/themes/AdminLTE/dist/img/user2-160x160.jpg"
}
PATCH /api/v1/users
const token = 'eyJhbGciOiJI...';
req.setRequestHeader('Authorization', token);
{
"name": "newName",
"email": "new_email@gmail.com",
"password": "newpassword123"
}
{
"message": "User updated with success"
}
DELETE /api/v1/users
const token = 'eyJhbGciOiJI...';
req.setRequestHeader('Authorization', token);
{
"message": "User deleted with success"
}
DELETE /api/v1/all-users
{
"key_admin": "keyadmin123"
}
{
"message": "Users deleted with success"
}
This project is licensed under the MIT License - see the LICENSE.md file for details
Created By ThiagoLuizNunes 2019.
FAQs
Mock-User-Auth is a mock user authentication API developed in Nodejs and Express using JWT as authenticator
The npm package mock-user-auth receives a total of 14 weekly downloads. As such, mock-user-auth popularity was classified as not popular.
We found that mock-user-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.