This is a boilerplate for building scalable and robust REST APIs using Node.js & TypeScript.
You need to install MongoDB either on your local machine or using a cloud service as mLab.
-
TypeScript as Language
-
Framework: Express.js
-
ODM: Mongoose
-
Authentication & Authorization with JSON Web Tokens
-
Easy configuration of environment variables thanks to dotenv
-
install the dependencies using
npm install
ornpm i
-
Rename the file
.env.example
to.env
-
Start the app using
npm run dev
-
After that, go to:
http://localhost:3658/api/users
Method | Resource | Description |
---|---|---|
POST |
/api/users/register |
Create a new user in the DB. You need to specify in the body the following attributes: firstname, lastname, email & password. |
POST |
/api/users/login |
Sign in with the email & password. If it's successful, it then generates a token |
GET |
/api/posts |
Returns the posts |
dev
- To run the app without transpile,start
- Build & run the transpiled app