Exposes locations of bikeshare bicycles that conform to the GBFS.
- Open
index.js
and changeprovider.name
to a unique name - Open
config/default.json
with any configurable parameters - Open
model.js
and implementgetData
to call your provider and return GeoJSON - Install dependencies
npm install
- Run a local server
npm start
- Add tests to
test/
File | Description | |
---|---|---|
index.js |
Mandatory | Configures provider for usage by Koop |
model.js |
Mandatory | Translates remote API to GeoJSON |
routes.js |
Optional | Specifies additional routes to be handled by this provider |
controller.js |
Optional | Handles additional routes specified in routes.js |
server.js |
Optional | Reference implementation for the provider |
test/model-test.js |
Optional | tests the getData function on the model |
test/fixtures/input.json |
Optional | a sample of the raw input from the 3rd party API |
config/default.json |
Optional | used for advanced configuration, usually API keys. |
Run server:
npm install
npm start
Example API Query:
curl localhost:8080/sample/FeatureServer/0/query?returnCountOnly=true
Tests:
npm test
During development you can output error callstack with
NODE_ENV=test npm start
Koop providers can be quickly deployed and scaled with AWS Lambda. To first create the service:
npm run lambda-create
To deploy code updates
npm run lambda-update
By default, AWS Lambda has a 3 second timeout and only 128MB memory. If your Koop provider uses a slower service, then you should change the AWS Lambda timeout to a higher time limit (e.g. 60 seconds) as well as add more memory (e.g. 512MB).
docker build -t koop-provider-sample .
docker run -it -p 8080:8080 koop-provider-sample
- run
npm init
and update the fields- Choose a name like
koop-provider-foo
- Choose a name like
- run
npm publish