Skip to content

A clean and minimal template for building scalable and well-structured RESTful APIs using Node.js and Express.

Notifications You must be signed in to change notification settings

matteopiffari/Node.js-api-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js api template

Status


📝 Table of Contents

📋 Modules used

  • 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.

🏁 Getting Started

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-template

Install all the modules:

matteopiffari@main:~$ npm i

Now you just need to edit the .env file and add your credentials.

🎈 Usage

matteopiffari@main:~$ cd Node.js-api-template
matteopiffari@main:~/Node.js-api-template$ npx ts-node src/server.ts

✍️ Authors

About

A clean and minimal template for building scalable and well-structured RESTful APIs using Node.js and Express.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published