Skip to content

alexanderHT/api-auth

 
 

Repository files navigation

Api-basic

Make a simple login application, admin create new user.

Notice

this app just have a back-end ( using node js and framework express), because of education purpose,
how the back end handle data from front-end. so you need curl on the terminal to send request to server (this app), or using postman

API

ROUTER HTTP DESCRIPTION
localhost:3000/api/auth/login POST login admin
localhost:3000/api/auth/profile POST admin profile
localhost:3000/api/auth/register POST Create a user by admin
localhost:3000/api/users GET Get all users
localhost:3000/api/users/:id GET Get one user
localhost:3000/api/users/:id DELETE Delete a user
localhost:3000/api/users:id PUT Update a user with new info

npm

1. express-generator
2. password-hash
3. jwt

Usage

1. npm install
2. npm run dev

how to use this app

1. fisrt you need to register by using this url : localhost:3000/api/users by method post, with key username and password
2. go to login
3. after that you will get a token, and then use it, use postman to check it, if the endpoint using get method then using header with x-access-token (req.headers) and fill the value by your token that you get

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.0%
  • HTML 2.9%
  • CSS 1.1%