Skip to content

LeopoldoAl/rest_api_node_ts_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST API NODE TS SERVER

Description

In this project, we worked with dependencies such as:

  • express
  • express-validator
  • sequelize
  • sequelize-typescript
  • swagger-jsdoc
  • swagger-ui-express
  • cors
  • colors
  • morgan

Also we worked with development depenncies such as:

  • @types/express
  • @types/jest
  • @types/supertest
  • @types/swagger-jsdoc
  • @types/swagger-ui-express
  • jest
  • nodemon
  • supertest
  • ts-jest
  • ts-node
  • typescript
  • @types/cors
  • @types/morgan

How about it goes this project:

This project has the purpose to create a REST API, which works appropriately when data are coming into Postgre database, executing operations such as:

  • Get Getting json data
  • Get by product by ID Get by product by ID
  • Insert Inserting json data
  • Updating with put method Updating json data
  • Updating with patch method Updating json data
  • Delete Deleting json data

This is can be acceded from another API with the objective of reading, writing, updating and deleting data to the database. Among the methods that have been used for working with the database are:

  • Get
  • Post
  • Put
  • Patch
  • Delete

About the deployment

As this project had been created using Node.Js, the most appropriately would be to use a server that works with Node, these servers could be for example railway, Fl0, render, and so on. In order to build this project, we use the next command combination:

npm install && npm run dev

We start the project with the command:

node dist/index.js

Something very important are the environment variables, the environment variables used by this project are the following:

  • DATABASE_URL: this variable allows us to connect to a database server both in local as online, and this database can be MySQL, PostgresSQL or any database that we can connect, using sequelize framework.
  • PORT: this is number provided by our hosting and can be for example 3000 or 10000 and so on.
  • FRONTEND_URL: this is the url that provides our hosting services and should be for example https://example.com or http://localhost:5173 but in both cases can never be for example https://example.com/ or http://localhost:5173/, it means the url without '/' to the end of the url.

This project was built using Node.js and Typescript technologies.

About

This project, we create a REST API on the server that connects with a PostgreSQL database, we use express for building the server in the backend, also use Jest for testing and Swagger for documenting our API, we use Sequelize with Typescript for consulting to the database, we use express-validator in order to validate our data and so on.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors