/ApiRest_Electronic_Devices_ExpressJS

Rest Api about electronic devices implemented with Express, Morgan, Railway ,NodeJS, Sequelize, Jest Testing, dotenv, cors, express-validator, Nodemon, Swagger, Swagger-ui, PostgreSQL, ohers.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Index app

ApiRest_Electronic_Devices_ExpressJS

Rest Api about electronic devices implemented with Express, Morgan, Railway ,NodeJS, Sequelize, Jest Testing, dotenv, cors, express-validator, nodemon, swagger, swagger-ui, PostgreSQL, ohers.


Index 📜

View

Section 1) Description, configuration and technologies

Section 2) Endpoints and Examples

Section 3) Functionality Testing and References



Section 1) Description, configuration and technologies

1.0) Description 🔝

View

1.0.0) General Description

1.0.1) Description Architecture and Operation


1.1) Project Execution 🔝

View

1.1.0) Initial settings

  • Once a work environment has been created through some IDE, we clone the project
git clone https://github.com/andresWeitzel/ApiRest_Dispositivos_Electronicos_ExpressJS
  • We position ourselves on the project
cd 'projectName'
  • We install the latest LTS version of Nodejs(v18).
  • We install all the necessary libraries
npm i
  • The environment variables used in the project are maintained to simplify their configuration process. It is recommended to add the corresponding file (.env) to the .gitignore.
  • The following script configured in the project's package.json is responsible for
    • Raise the server with express (productive environment)
    • Raise the server with express and nodemon (local dev environment)
    "scripts": {
       "dev": "nodemon src/server.js",
       "start": "node src/server.js"
     },
    
* We run the app from a terminal for a local environment.
```git
npm run dev
  • We run the app from a terminal for a productive environment.
npm start
  • If a message appears indicating that port 8080 is already in use, we can terminate all dependent processes and run the app again
npx kill-port 8080
npm run dev or npm start

1.2) Project configuration from scratch 🔝

View

1.2.0) Initial settings

  • Once a work environment has been created through some IDE, we clone the project
git clone https://github.com/andresWeitzel/ApiRest_Dispositivos_Electronicos_ExpressJS
  • We position ourselves on the project
cd 'projectName'
  • We install the latest LTS version of Nodejs(v18)
  • We open a terminal from vsc
  • We initialize a nodejs project
npm init -y
  • We create a .gitignore file and add the necessary files (for the moment node_modules)
node_modules
  • We create a direct source (src) to add all the logic of our app
  • We install the sequelize plugin
npm i sequelize
  • We install the plugins for postgreSQL
npm i pg pg-hstore
npm i express
npm i cors
npm i dotenv
npm i morgan
npm i -g nodemon
npm i nodemon --save-dev
npm i swagger-ui-express swagger-jsdoc
  • The environment variables used in the project are maintained to simplify their configuration process. It is recommended to add the corresponding file (.env) to the .gitignore.
  • The following script configured in the project's package.json is responsible for
    • Raise the server with express (productive environment)
    • Raise the server with express and nodemon (local dev environment)
    "scripts": {
       "dev": "nodemon src/server.js",
       "start": "node src/server.js"
     },
    
* We run the app from a terminal for a local environment.
```git
npm run dev
  • We run the app from a terminal for a productive environment.
npm start
  • If a message appears indicating that port 8080 is already in use, we can terminate all dependent processes and run the app again
npx kill-port 8080
npm run dev or npm start

1.3) Technologies 🔝

View
Technologies Version Purpose
SDK 4.3.2 Automatic Module Injection for Lambdas
NodeJS 14.18.1 JS Library
VSC 1.72.2 IDE
Postman 10.11 Http Client
CMD 10 Command Prompt for command line
Git 2.29.1 Version Control

Plugin Description
Serverless Plugin Libraries for Modular Definition

Extension
Prettier - Code formatter
YAML - Autoformatter .yml (alt+shift+f)


Section 2) Endpoints and Examples.

2.0) Endpoints and resources 🔝

View


Section 3) Functionality Testing and References.

3.0) Functionality test 🔝

View

3.1) References 🔝

View

Sequelize with PostgreSQL

Swagger and Nodejs

Video tutorials

Code Examples

Bookstores

Remark-lint

Railway