Skip to content

bhiravabhatla/nodejs-rest-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository creates 2 RESTful web services using nodejs to demonsrate contract testing using pactjs. The "accounts" service acts as the consumer and the "users" service is a producer.

The "account" service is called with necessary parameters which in turns calls the "users" service to fetch the resources from the database which in this case is a cloud hosted MongoDB instance.

How to use the repo?

  • clone the repo

  • create a mongodb sandbox on mLab and update the connection string in config.json. It should look like mongodb://:@ds123963.mlab.com:23963/mongo-sandbox

    or

  • run a docker instance of mongodb using the following steps

    • docker pull mongo
    • docker run --name <name of db> --restart=always -d -p 27017:27017 mongo mongod now update the connection string in config.json. It should be mongodb://localhost:27017
  • execute the command - npm install (run npm --version to verify whether npm is installed)

  • execute the command - npm start

The server now runs at http://localhost:3000

How to get all accounts from database?

How to get an account by its ID?

How to create a new account?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%