This project is for creating mock services that are not ideal (or not available) via Docker images.
In the binci.yml for a project, add the following to services:
services:
- mock-services:
from: 571506782996.dkr.ecr.us-east-1.amazonaws.com/draynow/mock-services
expose:
- 9000:9000
The /mocks directory contains files which are mapped to endpoints matching their name, i.e. ./mock/<mock-file> would create endpoints at http://<mock-service>/<mock-file>/....
In order to make these available, mock files should export an array of one or more endpoints in the following object format:
// FILENAME: /mocks/foo.js
[
{
path: '/some/path', // Support :param path string format
method: 'post', // HTTP method to bind to
fn: (req, res) => {
// Logic...
res.status(/*xxx*/).send(/*xxx*/)
}
}
]
When the above export is processed by index.js when the service starts it will create the following:
app.post('/foo/some/path', <fn>)
In order to replicate mocks correctly, obey is included in the dependencies to allow for creating data models which can be validated when a request is sent to the mock endpoint.
Content type
Image
Digest
Size
101.1 MB
Last updated
over 7 years ago
docker pull draynow/mock-services