Coder Social home page Coder Social logo

newaeonweb / jwtnewaeonserver Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 669 KB

Fake back-end Restful API powered by JsonWebToken, Json-Server and ApiDoc.

License: MIT License

CSS 13.11% HTML 23.95% JavaScript 62.94%
jwt-authentication json-server nodejs apidoc-generator

jwtnewaeonserver's Introduction

JWT NewAeonServer Restful API

Fake back-end Restful API powered by JsonWebToken, Json-Server and ApiDoc.

A small deadly simple server, including endpoints to: Signup, Login, Refresh Token, Chance Profile Password, Reset Password and User Roles.

How to use

Codacy Badge

code style: prettier

Build Status

Download or clone the repository.

Install dependencies:

npm install

Running the App:

npm start

(Optimal)To generate new API document:

npm run docs

Create a new user

POST: to http://localhost:3000/api/register

{
   "username":"Jhonny Cash",
   "email": "[email protected]",
   "password": "123456",
   "type": "Admin"
}

To see more details available go to: http://localhost:3000/apidoc/#api-User-PostApiRegister

Login user

POST: to http://localhost:3000/api/signup

{
   "email": "[email protected]",
   "password": "123456"
}

To see more details available go to: http://localhost:3000/apidoc/#api-User-PostApiSignup

How the API works

All endpoints created by the Json-Server database file (db.json) are protected by token authentication, this means that you must be logged in with a valid user and must use the following header:

{
    "Authorization": "Bearer <token>"
}

You receive this token in the success of the login endpoint, according to the following object:

{
     "auth": true,
     "token": "eyJhbGciOiJIUzI1NiIsInR...",
     "user": {
       "email": "[email protected]",
       "username": "Johnny Cash",
       "password": "123456",
       "type": "Amin",
       "id": 1
     }
 }

Adding your own endpoints

It is very easy to add new endpoints, you can create them in the Json-Server database file: db.json, simply by adding new objects, you can read more about it here.

Why use this project?

If you need to create prototypes quickly and unplugged for your front-end application, or you need to develop proof of concept about some Restful application, this project is for you. Since we have here common things in every application such as user authentication, login, signup, change password among other things.

License

MIT

jwtnewaeonserver's People

Contributors

codacy-badger avatar newaeonweb avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.