Skip to content
/ mbgen Public

An opinionated mountebank stubs generator for microservices.

License

Notifications You must be signed in to change notification settings

vamsib/mbgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mountebank is a great tool that allows us to mock services using different protocols. It is extremely stable and simple to use, yet very flexibile. When using in fast moving projects, though, boiler-plate code and organizing stubs can get unmanageable. Mbgen is an attempt to come up with a opinionated structure for organizing stubs and help teams move faster by generating this structure and most parts of the stubs.

Mbgen helps organize stubs in terms of microservices and scenarios within each microservices.

Example: orders microservice can have scenarios like place_order_ok and place_order_out_of_stock_error

Installing

npm i -D mbgen

You'll also need to install Mountebank.

npm i mountebank

Usage

Initialize imposters.ejs file and stubs folder for Mountebank:

npx mbgen init

Generate a microservice:

npx mbgen service

Generate stubs for scenarios in a microservice:

npx mbgen scenario

Each scenario has a directory created for it in the specified microservice. The scenario directory will have ejs stubs with boiler-plate code which you can edit.

Add the following to your package.json scripts:

{
  "scripts": {
    "start": "mb --configfile imposters.ejs"
  }
}

Modify your stubs and run npm start to start the Mountebank service

Built With

License

This project is licensed under the MIT License - see the LICENSE file for details

About

An opinionated mountebank stubs generator for microservices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published