Skip to content

well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB 馃獝

License

Notifications You must be signed in to change notification settings

ladunjexa/tsnode-express-mongodb-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

10 Commits

Repository files navigation

Project Banner Project Banner

TSNode & MongoDB REST API

well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB.

contributors last update forks stars open issues license


馃摂 Table of Contents

馃専 About the Project

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.

鈥硷笍 Folder Structure

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

馃懢 Tech Stack

My Skills

(back to top)

馃О Getting Started

馃攽 Environment Variables

In order to use this REST API you have to add some environment variables to .env file,

server-side [server/.env]

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

鈿欙笍 Installation

Step 1:

Download or clone this repo by using the command below:

 https://github.com/ladunjexa/TSNode-MongoDB-REST-API.git

Step 2:

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

Step 3:

In server folder execute the following command to get the required packages:

  npm install

馃弮 Run Locally

Step 1:

Go to server folder and execute the following command in order to start the server:

  npm start

(back to top)

馃憢 Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

鈿狅笍 License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

馃 Contact

Liron Abutbul - @lironabutbul6 - @ladunjexa

Project Link: https://github.com/ladunjexa/TSNode-MongoDB-REST-API

(back to top)

馃拵 Acknowledgements

This section used to mention useful resources and libraries that used in the REST API:

server-side

(back to top)