Git Product home page Git Product logo

ordermanagementservice_301's Introduction

OrderManagement server

This server has the different handlers for Order Management. This server is used by Aggregator service to get the order details for analysis purpose.

Getting Started

The server is written in node JS using express framework and mongoDB.

Prerequisites

Please install following softwares before pulling the project.

1,Node JS
2,MongoDB (running as a service)
3,Docker

Installing for Dev

1,Pull the code from this repository by executing the following command.

git clone https://github.com/Sivaraj23/OrderManagementService_301.git

2,move to the Order Management folder and execute npm install

cd  OrderManagementService_301
npm i

3,The project is now ready to run.

npm start

you can try placing order by hitting http://localhost:3002/api/orders/createOrder with followig payload.

      {	
      "user":<USER_ID_AS_STRING>,
        "restaurant":<RESTAURANT_ID_AS_STRING>,
        "orderItems" : [{
            "foodItem":<FOOD_ID_AS_STRING>,
            "quantity":<NUMBER>
        },
        {
            "foodItem":<FOOD_ID_AS_STRING>,
            "quantity":<NUMBER>
        }]
      }

Running the tests

Run the testcases by executing following command

npm run test

Deployment in Docker

building docker container

docker build -t orderserver .

To run in Docker

Run consul in docker container

docker run -d -p 8500:8500 -p 8600:8600/udp --name=badger consul agent -server -ui -node=server-1 -bootstrap-expect=1 -client=0.0.0.0

Run Mongo DB container

docker run --name mongoserver  -it -d mongo
docker run -it --link=mongoserver:mongo mongo /bin/bash

Get Mongo IP and PORT by executing the following command in mongo bash

env

To run Order Management server

docker run -e MONGO_IP="<MONGO_DB_IP>"  -e CONSUL_IP="<CONSUL_IP>" -e MONGO_PORT="<MONGO_DB_PORT>" -it -d -p <HOST_PORT>:<CONTAINER:PORT> orderserver

Built With

ordermanagementservice_301's People

Contributors

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