well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB.
This repository houses a well-structured REST API for User Management powered by MongoDB with cookie based authentication, with the abilities to Create, Read, Update users. REST API built with TypeScript, Node.js, Express & MongoDB.
Here is the folder structure of REST API.
TSNode-MongoDB-REST-API/
|- server/
|-- src/
|-- controllers/
|-- db/
|-- helpers/
|-- middlewares/
|-- router/
|-- index.ts
|-- .env
|-- nodemon.json
|-- tsconfig.json
|-- package.json
In order to use this REST API you have to add some environment variables to .env file,
create .env
file in server/
directory & add the following environment variables:
SESSION_TOKEN_NAME=<SESSION_TOKEN_NAME>
MONGODB_URL=<MONGODB_URL>
SECRET=<REST_API_SECRET>
PORT=<PORT> // optional, default set to 8080
Download or clone this repo by using the command below:
https://github.com/ladunjexa/TSNode-MongoDB-REST-API.git
This REST API using NPM (Node Package Manager), therefore, make sure that Node.js is installed by execute the following command in console: (minimum Node 14.x)
node -v
In server
folder execute the following command to get the required packages:
npm install
Go to server
folder and execute the following command in order to start the server:
npm start
Contributions are always welcome!
See contributing.md
for ways to get started.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Liron Abutbul - @lironabutbul6 - @ladunjexa
Project Link: https://github.com/ladunjexa/TSNode-MongoDB-REST-API
This section used to mention useful resources and libraries that used in the REST API: