Skip to content

QiaoranChelsea/login-system-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

login-system-backend

A log-in system backend built with node.js and MongoDB (Support Sign up, Sign in, Log out, verify token/session).

Prerequisite

  1. Npm
  2. NodeJS
  3. MongoDB

Steps to use this backend

  1. Add your own MongoDB infomation in app.js to make the database work.
  2. In root directory, run npm install
  3. start your server node server.js

Guideline for using backend APIs

  • sign up
    • function: store the user's registration info into the database.
    • METHOD: POST
    • Request URL: /account/signup
    • post data :
    {
      "password": "passwordtest",
      "email": "test1@gmail.com",
      "firstName":"test1_firstname",
      "lastName":"test1_lastname"
    }
    
    • server response : {success: true, message:'sign up!}' when signUp success
  • sign in
    • function: check if the email and password users entered are consistent with records from database.
    • METHOD: POST
    • post data : /account/signin
    {
      "password": "passwordtest",
      "email": "test1@gmail.com"
    }
    
    • server response (when sign in success) :
    { "success": "true",
      "message":'valid sign in!',
      "token": "<a token id>" 
    }
    
  • verify token/session
    • function: veryfy if the token is consistent with record form database and it's not deleted(log out) .
    • Request URL: /account/verify?=<token id>
    • METHOD: GET
    • server response(when verify success):
    { 
     "success": "true",
     "message":'good',
    }
    
  • Log out
    • function: log out from system
    • Request URL: /account/logout?=<token id>
    • METHOD: GET
    • server response(when log out success):
    { 
      "success": "true",
      "message":'log out successfully',
    }
    

Credit

About

A log-in system backend built by node.js and MongoDB (Support Sign up, Sign in, Log out, verify token/session).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors