Giter VIP home page Giter VIP logo

men-structure's Introduction

MEN-Structure

There are 5 folders in this project:

  • config
  • db
  • middlewares
  • models
  • tests

Config

This folder will be in charge of the server configuration for the following environments:

  • local
  • test
  • production

We will put all the configurations here so any changes in different environment will be made here only. This folder will have two files. config.json and config.js

config.json is a simple JSON or maybe BSON and will hold key information for different environments. config.js file will decide which environment we are and based on that it will load the details of that environment into the environment variables of the machine.

As it can be seen in the config.js file, the environment variable of NODE_ENV is not defined locally. So what happens is that it will get the details from the config.json file (either TEST or DEVELOPMENT environment) and will load the details, create those environment variables and load the values into them. As it can be seen by default the value is development as NODE_ENV does not exist. But if we want to push test we should do it by test script inside the package.json file. Later we will go through its details.

db

This folder will hold a file for our database connection. We can name the file mongoose.js.

middleware

This folder will hold our middlewares for example authenticate middleware or log middle or anything you might have in mind you can keep here.

test

This folder will hold our test scripts using mocha, expect, supertest and nodemon. Inside test folder, we should have another folder called seed (seed.js) which will push in data for us before our tests. It is very useful. All tests for the server.js file will also go into server.test.js file located in test folder.

men-structure's People

Contributors

amin-wan-kenobi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.