Skip to content

This is an example project for those who want to bootsrap an API using Express and MongoDB.

Notifications You must be signed in to change notification settings

omerg/express-mongodb-base

Repository files navigation

Express MongoDB Base

Build Status contributions welcome

This is an example project for those who want to bootsrap an API using Express and MongoDB.

Demo

https://express-mongodb-base.herokuapp.com/api

Heroku Automatic Deployment

Deploy

If you forked this repository, you can link it to your heroku app afterwards.

Pre-reqs

To build and run this app locally you will need a few things:

Getting started

  • Install dependencies
cd <project_name>
npm install

Running the project

You can simply call Npm Script:

$ npm start

Or you can bootstrap the project right away using Docker:

$ docker-compose up

Start Using the API at http://localhost:3001/api/

Debugging the project

In order to enable debugging in local environment, start project with the following command:

$ npm run debug

Note on editors! - TypeScript has great support in every editor . You can place breakpoints in TypeScript code and debug at runtime.

For configuration of your favorite IDE, see the documentation for:

Feature Highlights

  • File Structure

    • The project file structure is defined as below:
      • src/dao for Data Access Objects
      • src/model for Database Object Model Representations
      • src/routes/api for API Routes
      • src/services for Services
  • Express-JWT

    • Token Based Authorization
  • Inversify

    • Annotation Based Configuration
    • Inversion of Control
  • Mongoose

    • Object Relational Mapping (ORM) Layer
    • Model Validation
    • Data Access Object (DAO) Layer
    • Create Read Update Delete (CRUD) Operations Abstracted via Super Class
  • Nodemon

    • Hot Reloading
  • Docker

    • Containerization
    • Docker Compose used to attach MongoDB Image to application
  • Travis CI

    • Continuous Integration
    • Has an extra .gitlab-ci.yml file for Gitlab users!