Heroku Buildpack for Prism's HTTP mock server
Prism creates a mock server from any OpenAPI spec.
This Heroku buildpack enables Prism mock servers to be deployed easily on Heroku.
The premise is to have a Heroku app dedicated for the Prism mock of one OpenAPI spec i.e. if you have three OpenAPI specs that you want to have Prism mocks on Heroku for, you will have three corresponding Heroku apps. If you also have an implementation of your OpenAPI spec that you also want to deploy on Heroku, you would use an entirely separate Heroku app for that.
-
Tell your Heroku app to use this
heroku-buildpack-prism
buildpackSetting the buildpack can either be done at Heroku app creation time, e.g:
heroku create --region eu --buildpack https://github.com/agilepathway/heroku-buildpack-prism.git my-heroku-app
or at any time by using
heroku buildpacks:set
, e.g:heroku buildpacks:set https://github.com/agilepathway/heroku-buildpack-prism.git
-
Specify the Prism mock server startup command in the Heroku Procfile
Heroku apps include a Procfile that specifies the commands that are executed by the app on startup.
Create a file called
Procfile
(no file extension), with the following content - replacingopenapi.yaml
with the path to your YAML or JSON OpenAPI spec.web: prism mock openapi.yaml --errors -h 0.0.0.0 -p $PORT
Note that the host has to be specified as
0.0.0.0
and the port has to be Heroku's dynamically assigned$PORT
That's it! 😎