Skip to content

mdskrumi/express-template

Repository files navigation

Express API Template

This is a Node js, TypeScript and Express js framework backend with MongoDB as a database.


Requirements

For development, you will only need Node.js and a node global package, Yarn, installed in your environment.

Node.js v16 or greater [Because of using Modules: node:module API]

If the installation was successful, you should be able to run the following command.

$ node --version
v16.x.x

$ npm --version
8.x.x

If you need to update npm, you can make it using npm! Cool right? After running the following command, just open again the command line and be happy.

$ npm install npm -g

Yarn installation

After installing node, this project will need yarn too, so just run the following command.

  $ npm install -g yarn

MongoDB

The project uses MongoDB as a database. Or install the Community Edition from https://www.mongodb.com/docs/manual/administration/install-community/

Start the MongoDB server

TBA

Project installation

$ git clone https://github.com/mdskrumi/express-template.git
$ cd express-template
$ yarn install

Configure app environment

Open src/index.ts then edit accordingly:

  • PORT: default as it is: 6600;
  • MONGO_PATH: default as it is mongodb://localhost:27017/{db_name};

You will also need to update environment properties type for validation at src/utils/validateEnv.ts

Running the project

$ NODE_ENV=stg yarn start

Available environments:

  • NODE_ENV=dev
  • NODE_ENV=stg
  • NODE_ENV=prod

Development run with hot reload

$ yarn dev

Simple build for production

$ yarn build

Generate new module

$ yarn g

Project structure

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors