- 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