Skip to content

designerexpert/mnc_back

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Ops Notes:

  1. Knex Configurations / Commands

    • knex init
    • knex migrate:make initial
    • inside: data/dbConfig.js change development to production when ready to deploy
  2. Authentication Configurations

    • Change: config.js secret: before deploying final.

API Endpoints:

Registration:

Request Type: POST

  1. Navigate to /register
  2. Provide a user object following this template:
{
    "email": "[email protected]",
    "password": "1234"
}
  1. Server will return the following object if successful:
{ "message": "success" }
  1. Server will return the following error if unsuccessful:
{
    "errorMessage": "unable to register user. Already registered? Try to log-in instead!"
}

Login:

Request Type: POST

  1. Navigate to /login
  2. Provide a user object following this template:
{
    "email": "[email protected]",
    "password": "1234"
}
  1. Server will return an object like this one if successful:
{
    "id": 7,
    "email": "[email protected]",
    "auth": true,
    "createdAt": "2018-02-13 19:40:33",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MTg1NTQ5NjAsImRhdGEiOiJ0ZXN0QGVtYWlsLmNvbSIsImlhdCI6MTUxODU1MTM2MH0.ijuolir7q2nkMa50Td6JLNLqfkdmUn7t7tuh89oEb_M"
}
  1. Server will return this error if unsuccessful:
{
    "errorMessage": "User not Authenticated, Please log-in again!"
}

List Users:

Request Type: Get

  1. Navigate to /users
  2. Provide a JWT with the token that was given when the user logged in in the headers Authorization.
  3. A list of users will be returned.
  4. Server will return this error if unsuccessful:
{
    "error": "Token invalid, please login",
    "message": {
        "name": "JsonWebTokenError",
        "message": "invalid signature"
    }
}

Delete a User:

Request Type: Delete

  1. Navigate to /users
  2. Provide a user object like the one bellow:
{
    "email": "[email protected]",
    "password": "1234"
}
  1. Server will return 1 if the user was deleted successfully.
  2. Server will return an error if it was unable to delete the user.

Update a User's Password:

Request Type: Put

  1. Navigate to /update
  2. Provide a user object like the one bellow.
{
    "email": "[email protected]",
    "password": "1234",
    "newPassword": "4321",
}
  1. Server will return 1 if the user was updated successfully.
  2. Server will return an error if it was unable to update the newPassword, or was unable to authenticate with the provided password.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published