node package manager


generator-powdered-toast NPM version Build Status Dependency Status Coverage percentage


Generator-powdered-toast uses Yeoman to generate a mock server based on a Swagger specification. This is useful for front-end development when you have a swagger specification of an API that is being actively developed. No more waiting for the API developers to deploy to a development server. Get started building your boss UX right away.

Have a production or development API that is being changed? You can seemlessly proxy requests not specified in the Swagger to those upstream services by adding an optional proxy.

The powdered-toast server uses the following technolgy stack:

  • hapi.js - A badass Node.js REST server from the ninjas at
  • A fork of Swagmock - A Swagger based mocking library.
  • swaggerize-hapi - A Swagger based hapi.js plugin.
  • hapi-swaggered-ui - A Swagger UI implementation for hapi.js.
  • h2o2 - A proxy handler plugin for hapi.js.

Making Powdered Toast

Make sure you have pre-installed node.js, npm, and Yarn. Install Yeoman and generator-powdered-toast globally using npm.

npm install -g yo
npm install -g generator-powdered-toast

Then generate your project.

yo powdered-toast

Running Your Shiny New Powdered Toast

Issue the following command to start the powdered-toast service locally.

npm start


Powdered-toast uses dotenv to configure environmental variables. Take a look at the .env file in the root of the project. A description of the variables follows the example.



This is the host name within the server network dns. When you run powdered-toast locally it will generally match the UI_HOST value. However, sometimes you may have different values as in a Docker stack.


This is the internal network port for the API.


This is the API hostname that the client will use. In a Docker stack this could be different based on the port forwarding configuration.


This is the port that a client will use to hit the API.


This is the web sockets port used by the debugger UI.

NOTE: When powdered-toast runs in TLS mode the debugger UI is currently not working. There is an issue with connecting over wss.


This is the protocol for the upstream services. Can be either 'http' or 'https'.


This is the upstream hostname.


This is the optional host header that will be set on proxy requests.


If set to "true" the service will run over https with self-signed certs.


There are currently two debuggers - one in the main server file and one the proxy controller. These are activated my adding them to a comma seperated string. To turn off debugging, remove the entries.

Regenerate from Swagger using Yeoman

In the case you want to mofify the Swagger specification, the following command will use Yeoman to regenerate handlers and data.

npm run regenerate

If there are conflicts you will be prompted to overwrite.

Swagger UI

A Swagger UI instance is included for viewing and testing the API.


Dredd Testing

Powdered-toast includes Dredd to test your API. To run Dredd tests just run the following in a terminal:

npm run dredd


Apache-2.0 © Gregory Buchenberger