https://github.com/firstclasspostcodes/firstclasspostcodes-mock
🔀 Provides a mock HTTP server that responds like the real Firstclasspostcodes API to make test suites integrating with us faster and less brittle.
https://github.com/firstclasspostcodes/firstclasspostcodes-mock
docker firstclasspostcodes nodejs
Last synced: about 1 year ago
JSON representation
🔀 Provides a mock HTTP server that responds like the real Firstclasspostcodes API to make test suites integrating with us faster and less brittle.
- Host: GitHub
- URL: https://github.com/firstclasspostcodes/firstclasspostcodes-mock
- Owner: firstclasspostcodes
- License: mit
- Created: 2019-06-21T12:51:21.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-29T08:15:37.000Z (about 5 years ago)
- Last Synced: 2025-01-26T13:16:37.117Z (about 1 year ago)
- Topics: docker, firstclasspostcodes, nodejs
- Language: JavaScript
- Homepage:
- Size: 1.4 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔀 API Mock

A HTTP mock server that responds like the real Firstclasspostcodes API. It is intended for use by clients integrating with our API, in order to improve integration testing and to ensure tests are less brittle.
To get started using the API, [read the docs](https://docs.firstclasspostcodes.com).
We provide clients in [Ruby](https://github.com/firstclasspostcodes/firstclasspostcodes-ruby), [PHP](https://github.com/firstclasspostcodes/firstclasspostcodes-php), [Javascript/NodeJS](https://github.com/firstclasspostcodes/firstclasspostcodes-js), [Python](https://github.com/firstclasspostcodes/firstclasspostcodes-python). To configure the client libraries to connect to this mock API, view the relevant library documentation.
## Usage
A docker container is provided for ease of use:
```sh
docker run -p 80:2345 firstclasspostcodes/mock:v4.0.5.
```
Now start calling the Firstclasspostcodes API:
```
curl -H 'X-Api-Key:111111111111' http://localhost:2345/postcode?search=AR514UI
```
### API Key
The API Key is **always** `111111111111`. If an API Key is not provided, `403` response is returned.
## Data
A small set of test data is available for querying through the mock API. A special endpoint is provided `GET: /data/.postcodes` which will list all postcodes currently provided for testing purposes.
Whilst the test data is sourced from our live API, it may not be in sync with updates.
> Note: Additional postcodes will be added in **major releases**.
## Local Development
This is a node project, so first run `npm i` to fetch all the project dependencies. You'll also need a local version of the OpenAPI specification file to work with:
```
curl -o spec.json https://api.firstclasspostcodes.com/data/.spec
```
Running `npm start` will boot up the server.