Skip to content

emunoz-qsudaca/API-REST-Typescript-MySQL-Auth-JWT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST API TYPESCRIPT MYSQL JWT

CRUD REST API with auth.

Project Setting

Modules:

  • typescript
  • express
  • jsonwebtoken

Dev Modules:

  • ts-node-dev
  • morgan
  • mysql2
  • bcryptjs
  • @types/bcryptjs
  • @types/Express
  • @types/jsonwebtoken
  • @types/morgan

API Reference

You can get users and posts without necesity to bring a token, but to UPDATE, DELETE or POST you need to be registered and send the JWT in headers request, like "authorization" Bearer Token.

When create a post, the author is by default the username of the active session provided by our jwt.

Get USERS

  GET /api/user
Parameter Type Description
user_id number id automatically
username string username UNIQUE
email string email UNIQUE
password string excrypted password
created_at TIMESTAMP current_timestamp automatically

Get POSTS

  GET /api/post  ||  GET /api/post/:id
Parameter Type Description
post_id number id automatically
title string titile
post string post content
author string uername got from token automatically
created_at TIMESTAMP current_timestamp automatically

Authors

About

CRUD API / user creation & protected routes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published