项目作者: quantworksinc

项目描述 :
A RAML configurable API server with hot-reloading.
高级语言: JavaScript
项目地址: git://github.com/quantworksinc/mast.git
创建时间: 2018-02-20T17:13:08Z
项目社区:https://github.com/quantworksinc/mast

开源协议:MIT License

下载


MAST - Mock API Server for Testing

A configurable API server for mocking.

MAST was created to facilitate rapid mocking of APIs. This supports:

  • unit/integration testing of external APIs
  • frontend development against yet-to-be-developed services

Get the image at Docker Hub.

Develop an API

Create an api.raml file compliant with the RAML API spec.

Pull the MAST container.

  1. docker pull quantworks/mast

Run the container with your api.raml mounted to /srv/api/api.raml. This allows you to edit/save your api.raml and the server will hot-reload the API.

  1. docker run -it --rm \
  2. -p 80:80 \
  3. -p 443:443 \
  4. -v $(pwd)/api.raml:/srv/api/api.raml \
  5. quantworks/mast:latest
  6. # or with custom ports
  7. docker run -it --rm \
  8. -e HTTP=8080 \
  9. -e HTTPS=8443 \
  10. -p 80:8080 \
  11. -p 443:8443 \
  12. -v $(pwd)/api.raml:/srv/api/api.raml \
  13. quantworks/mast:latest

Test it!

  1. curl -s http://0.0.0.0/endpoint | jq .
  2. curl -sk https://0.0.0.0/endpoint | jq .

Create a new mock service

Create a Dockerfile.

  1. FROM quantworks/mast:latest

Write an api.raml file. Then build and run your container.

  1. docker build -t my-api:latest .
  2. docker run -it --rm \
  3. -p 80:80 \
  4. -p 443:443 \
  5. my-api:latest
  6. # or with custom ports
  7. docker run -it --rm \
  8. -e HTTP=8080 \
  9. -e HTTPS=8443 \
  10. -p 80:8080 \
  11. -p 443:8443 \
  12. -v $(pwd)/api.raml:/srv/api/api.raml \
  13. quantworks/mast:latest

Test it!

  1. curl -s http://0.0.0.0/endpoint | jq .
  2. curl -sk https://0.0.0.0/endpoint | jq .

License

MIT