This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| name: 'agol', // Required, the name of this provider and the start of all its URLS | |
| type: 'provider', // Required, the type of Koop Plugin this is | |
| version: require('./package.json').version, // Required, the version of this provider | |
| Model: require('./agol'), // Required contains getData and other functions called by controller | |
| hosts: true, // Optional, whether or not `getData` should receive a `host` parameter | |
| disableIdParam: false, // Optional, whether or not `getData` should receive an `id` parameter | |
| routes: require('./routes'), // Optional, any additional routes that should be handled by this provider | |
| Controller: require('./controller'), // Optional, a controller to support unique routes | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Example request: http://koop.com/craigslist/washingtondc/apartments/FeatureServer/0/query?where=price>20&f=geojson | |
| Req is the express request object: https://expressjs.com/en/4x/api.html#req | |
| req.params = { | |
| host: 'washingtondc', | |
| id: 'apartments' | |
| } | |
| req.query = { | |
| where: 'price > 20', | |
| f: geojson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = [ | |
| { | |
| path: '/agol/:id/datasets', | |
| methods: ['get'], | |
| handler: 'get' | |
| }, | |
| { | |
| path: '/agol/:id/datasets/:dataset.:format', | |
| methods: ['get'], | |
| handler: 'get' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function (model) { | |
| this.model = model | |
| /** | |
| * returns a list of the registered hosts and their ids | |
| */ | |
| this.get = function (req, res) { | |
| this.model.log.debug({route: 'dataset:get', params: req.params, query: req.query}) | |
| if (req.params.dataset) this._getDataset(req, res) | |
| else this._getDatasets(req, res) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| const ttl = 60 * 60 | |
| const request = require('request').defaults({gzip: true}) | |
| const types = require('./mappings/types.js') | |
| module.exports = function (koop) { | |
| // This is our one public function it's job its to fetch data from craigslist and return as a feature collection | |
| this.getData = function (req, callback) { | |
| const key = `craigslist::${req.params.host}::${req.params.id}` | |
| koop.cache.retrieve(key, req.query, (err, geojson) => { | |
| if (geojson) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Koop = require('koop') | |
| const koop = new Koop() | |
| koop.server.listen(80) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express') | |
| const app = express() | |
| const Koop = new Koop() | |
| app.use(koop.server) | |
| app.listen(80) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //clean shutdown | |
| process.on('SIGINT', () => process.exit(0)) | |
| process.on('SIGTERM', () => process.exit(0)) | |
| // Initialize Koop | |
| const Koop = require('koop') | |
| const koop = new Koop() | |
| // Install the Yelp Provider | |
| const yelp = require('yelp') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "koop-trimet", | |
| "version": "1.0.8", | |
| "description": "A Trimet provider for koop", | |
| "main": "index.js", | |
| "directories": { | |
| "test": "test" | |
| }, | |
| "scripts": { | |
| "start": "node server.js", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GET /:provider/:id | |
| DELETE /:provider/:id | |
| PUT /:provider/:id Content-Type: application/json | |
| { | |
| name: | |
| description: | |
| schemas: { | |
| georgia: { | |
| }, |