This is an example project for those who want to bootsrap an API using Express and MongoDB.
https://express-mongodb-base.herokuapp.com/api
If you forked this repository, you can link it to your heroku app afterwards.
To build and run this app locally you will need a few things:
- Install dependencies
cd <project_name>
npm install
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/
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:
-
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
- The project file structure is defined as below:
-
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!