Skip to content

An Express API starter using Monk to communicate with MongoDB.

License

Notifications You must be signed in to change notification settings

mikejhnstn/express-mongodb-starter

Repository files navigation

Express MongoDB Starter

screenshot Example response in Insomnia

Description

An Express API starter using Monk to communicate with MongoDB.

Dependencies

Default:

  • body-parser
    • parse incoming body requests
  • cors
    • middleware for enabling cross origin resource sharing
  • dotenv
    • module for loading .env variables
  • express
    • server framework
  • helmet
    • http header security
  • monk
    • tiny mongodb communication layer
  • morgan
    • request logger middleware

Dev dependencies:

Project structure

/config
    connection.js -- set the db and port values using dotenv
/controllers
    posts.js -- logic for handling db with monk
/middleware
    404_handler.js -- 404 response handler
    error_handler.js -- general error handler
/routes
    posts.js -- assign endpoints
/test
    app.test.js -- example testing with mocha and supertest
env.sample -- example of environment variables
app.js -- main express app
package.json -- required dependencies

Requirements

  • Change .env.sample to .env and edit variables

  • NPM, Node, MongoDB

  • Global dependencies

npm install nodemon mocha -g

Commands

Install dependencies

npm install

Run application

npm run start

Run application in development mode

npm run dev

Run tests

npm run test

About

An Express API starter using Monk to communicate with MongoDB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published