Giter Club home page Giter Club logo

node-express-mongodb-seed-project's Introduction

node-express-seed-project

RESTful application using nodejs, expressjs and mongodb

Objective

The objective of the project is to create a basic structure for a RESTful application using nodejs, expressjs and mongodb.

Prerequisite


Download and install nodejs (https://nodejs.org/en/)
Download and install mongodb (https://www.mongodb.org/downloads#production)

Environment

Windows
Git Bash
Postman chrome pulgin

Highlights


Logger based on Winston
Environment based configuration using config(https://www.npmjs.com/package/config#introduction)

Running the application

  • Clone the project

  • Open Git Bash
    $ cd <basepath>
    $ git clone https://github.com/guptam2/node-express-mongodb-seed-project.git

  • Install node modules

  • $ cd <basepath>/node-express-mongodb-seed-project
    $ npm install

  • Start mongodb

  • Open Git Bash
    $ cd "/c/Program Files/MongoDB/Server/3.2/bin"
    $ mongod
    * Mongodb folder might be different based on your installation.

  • Start nodejs server

  • $ cd <basepath>/node-express-mongodb-seed-project
    $ node server.js

  • Send a POST request (Postman plugin)

  • URL : http://localhost:3000/contacts
    Request Body :

    {"firstName":"m", "lastName":"g","phone":"123456789", "addressLine1":"3 test road","addressLine2":"test city", "county":"berkshire","postcode":"tt1 2tt"}

    Content Type : application/json

  • Send a GET request (Postman plugin)

  • URL : http://localhost:3000/contacts

  • Config

  • Different config file can be loaded by setting the NODE_ENV environment variable. Default config file is <basepath>\node-express-seed-project\config\default.json

    e.g. $ export NODE_ENV=dev

    It will load the <basepath>\node-express-seed-project\config\dev.json

  • Check the log

  • Default log file is C:\tmp\node-express-seed-project.log

    To change the log file location modify the <basepath>\node-express-seed-project\config\default.json.

node-express-mongodb-seed-project's People

Contributors

mgtest2 avatar

Watchers

 avatar  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.