Skip to content

Latest commit

 

History

History
79 lines (49 loc) · 2.27 KB

readme.md

File metadata and controls

79 lines (49 loc) · 2.27 KB

RESTful API

📄 About

This RESTful API is part of the backend of an application that i am developing.

Their sharing aims to show some of the knowledge that i have acquired over the past few months, in which i have dedicated myself to the study of the most varied development technologies for the web.

📦 Dependencies

Dependencies used for the development of the application.

- bcryptjs: Password Hashing
- express: Server Creation
- jsonwebtoken: JWT Authentication
- pg: PostgreSQL Client 
- pg-hstore: Serializing and deserializing JSON data
- sequelize: ORM
- sequelize-cli: Sequelize Command Line Interface
- yup: HTTP Request Validations

📦 Dev Dependencies

All other dev dependencies, which are not listed below, are merely for linting the code.

- nodemon: Auto-Reload Application on File Changes
- sucrase: Import and Export Syntax

Features

This application was developed based on an MVC architecture model (Model, View, Controller).

Note: The view will be represented in the application by a web page and possibly a mobile application

🔀 Routes

Create User
- Route: http://localhost:3000/users
- HTTP Method: POST
- Model: User
- Controller: UserController
Update User
- Route: http://localhost:3000/users
- HTTP Method: PUT
- Model: User
- Controller: UserController
Login User
- Route: http://localhost:3000/login
- HTTP Method: POST
- Model: User
- Controller: LoginController
Authentication Middleware
- Global middleware, executed before any user update request

- Its purpose is to validate the authentication of a user, using the token sent in the request authentication header

🔧 Configurations

📁 src/config/

- authConfig.js (already with MD5 Encryption for jwt.sign)
- database.js (needs username, password and database name)

📀 Deploy

- yarn (install dependencies listed on packade.json)
- yarn sequelize db:migrate  (to run migrations)     
- yarn sequelize db:seed:all (seeds the database)
- yarn dev (start the application, requires nodemon)