- ts-node → Allows you to run TypeScript code directly in Node.js without compiling it first.
- express → A fast and minimal web framework for building APIs and web applications in Node.js.
- dotenv → Loads environment variables from a .env file into process.env, making it easy to manage configuration.
- jsonwebtoken → Used to create and verify JSON Web Tokens (JWT), commonly for authentication and authorization.
- compression → Middleware that enables Gzip compression to reduce the size of the HTTP response.
- cookie-parser → Middleware that parses cookies attached to the client request object.
- cors → Enables Cross-Origin Resource Sharing (CORS), allowing your API to be accessed from different domains.
- bcrypt → A library to securely hash and compare passwords using the bcrypt algorithm.
- mysql2 → A modern MySQL client for Node.js with support for Promises and prepared statements.
- validator → A library of string validators and sanitizers, useful for validating input like emails, URLs, etc.
To download the source code you just need to type this in a bash:
matteopiffari@main:~$ git clone https://github.com/matteopiffari/Node.js-api-templateInstall all the modules:
matteopiffari@main:~$ npm iNow you just need to edit the .env file and add your credentials.
matteopiffari@main:~$ cd Node.js-api-template
matteopiffari@main:~/Node.js-api-template$ npx ts-node src/server.ts- matteopiffari - Idea & Work