Skip to content

AmbroseByamugisha/Node_JS_JWT_Auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NODE-JS JWT-AUTHENTICATION

A JWT Authentication server, developed the back-end API with NodeJs and ExpressJs

Table of Contents (Optional)

Usage

Features

Add to Base URL above

  • Use the following Endpoints

    POST /auth/signup Create User Account

    POST /auth/signin Login A User

    GET /user/seed Seed users table with users with admin rights

    POST /admin/signup An admin can add new admin (Needs admin priviledges)

    PUT /user/:id/admin An admin can give a registered user admin right (Needs admin priviledges)

  • A successful response will be

     { status: 'success', data: {} }

    or

     { status: 'success', data: [] }

    and an unsuccessful response will be

    { status: 'error', error: '​relevant-error-message' }

Contributing

I would love to hear from anyone that will like to contribute

Prerequisites

Settings

If you want set up locally you can follow these steps, you can also use postman(https://www.getpostman.com/downloads/) to test. Clone the repository, open terminal in root and do the following on terminal

$ npm install

After Setting up the database, create database tables running the command below, its advisable to run the command more than once and make sure your database is updated with the tables:

$ npm run create-dev-tables

Start server by running:

$ npm run start

Seed Database tables with users(with admin right) by running the command below, its advisable to run it more than once:

$ npm run seed-user-table

or use

GET /user/seed Endpoint

Test endpoints by running:

$ npm run test

Deploy on heroku by adding the following line to the script object in package.json:

"heroku-postbuild": "babel-node ./app/db/dev/dbConnection createAllTables"

Run:

git push heroku master

Change the value of "heroku-postbuild" to:

"heroku-postbuild": "babel-node ./app/helpers/seed seedUser"

And run

git push heroku master

License

None for now.

developed with 💕 by Blessing Krofegha

About

Simple JWT Authentication API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published