Skip to content

Another shitcode that I will definitely use in my future projects

Notifications You must be signed in to change notification settings

Creepy0964/auth-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auth-module

Authentification module written in JavaScript using Node.JS, Express, SQLite3 and CryptoJS. Designed for future use in some of my projects.

Routes

POST /api/auth/login

Query parameters

param typeof required example_value desc
username string yes 'creepy0964' Username
password string yes '123456' Password. Converted to MD5

Responses

http_code desc reason
200 OK Server succesfully logged the user in -
401 UNAUTHORIZED Invalid credentials User not found / Incorrect password

Examples

200 OK

{
    'login': 'ok'
}

401 UNAUTHORIZED

{
    'login': 'fail',
    'reason': 'user not found'
}

POST /api/auth/register

Query parameters

param typeof required example_value desc
username string yes 'creepy0964' Username
password string yes '123456' Password. Converted to MD5

Responses

http_code desc reason
200 OK Server succesfully registered the user -
400 BAD_REQUEST Invalid request body: some credentials are missing No username / password is provided
409 CONFLICT User already exists User already exists
500 INTERNAL_SERVER_ERROR Returned when error is not specified -

Examples

200 OK

{
    'register': 'ok'
}

400 BAD_REQUEST

{
    'register': 'fail',
    'reason': 'no username / no password'
}

409 CONFLICT

{
    'register': 'fail',
    'reason': 'user already exists'
}

500 INTERNAL_SERVER_ERROR

{
    'register': 'fail',
    'reason': ''
}

About

Another shitcode that I will definitely use in my future projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published