├── koop.json ├── config └── default.json ├── test └── index.js ├── src ├── routes.js ├── request-handlers │ └── welcome.js ├── plugins.js └── index.js ├── .travis.yml ├── .gitignore ├── LICENSE ├── package.json └── README.md /koop.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "app" 3 | } 4 | -------------------------------------------------------------------------------- /config/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "port": "8080" 3 | } 4 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | var test = require('tape') 2 | 3 | test('Example Test', function (t) { 4 | t.plan(1) 5 | t.pass('No tests defined.') 6 | }) 7 | -------------------------------------------------------------------------------- /src/routes.js: -------------------------------------------------------------------------------- 1 | const welcome = require('./request-handlers/welcome') 2 | 3 | module.exports = [ 4 | { 5 | path: '/', 6 | methods: ['get'], 7 | handler: welcome 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - lts/* 4 | sudo: false # Enable docker-based containers 5 | cache: 6 | directories: # Cache dependencies 7 | - node_modules 8 | script: 9 | - npm test 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac 2 | .DS_Store 3 | Icon 4 | ._* 5 | .Spotlight-V100 6 | 7 | # SublimeText 8 | /*.sublime-project 9 | *.sublime-workspace 10 | *.sublime-project 11 | .idea/* 12 | 13 | # Node 14 | node_modules 15 | npm-debug.log -------------------------------------------------------------------------------- /src/request-handlers/welcome.js: -------------------------------------------------------------------------------- 1 | function handleRequest (req, res) { 2 | res.status(200).send(` 3 | Welcome to Koop! 4 | 5 | Installed Providers: 6 | Github 7 | Craigslist 8 | `) 9 | } 10 | 11 | module.exports = handleRequest 12 | -------------------------------------------------------------------------------- /src/plugins.js: -------------------------------------------------------------------------------- 1 | const github = require('@koopjs/provider-github') 2 | const craigslist = require('koop-provider-craigslist') 3 | 4 | // list different types of plugins in order 5 | const outputs = [] 6 | const auths = [] 7 | const caches = [] 8 | const plugins = [ 9 | { 10 | instance: github 11 | }, 12 | { 13 | instance: craigslist 14 | } 15 | ] 16 | 17 | module.exports = [...outputs, ...auths, ...caches, ...plugins] 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Esri 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | > http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const config = require('config') 2 | const Koop = require('@koopjs/koop-core') 3 | const routes = require('./routes') 4 | const plugins = require('./plugins') 5 | 6 | // initiate a koop app 7 | const koop = new Koop() 8 | 9 | // register koop plugins 10 | plugins.forEach((plugin) => { 11 | koop.register(plugin.instance, plugin.options) 12 | }) 13 | 14 | // add additional routes 15 | routes.forEach((route) => { 16 | route.methods.forEach((method) => { 17 | koop.server[method](route.path, route.handler) 18 | }) 19 | }) 20 | 21 | // start the server 22 | koop.server.listen(config.port, () => koop.log.info(`Koop server listening at ${config.port}`)) 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "koop-app-example", 3 | "description": "Sample koop express application with some common koop providers.", 4 | "version": "1.0.0", 5 | "author": "Esri R&D", 6 | "bugs": { 7 | "url": "https://github.com/koopjs/koop-app-example/issues" 8 | }, 9 | "dependencies": { 10 | "@koopjs/koop-core": "^10.1.0", 11 | "@koopjs/provider-github": "^3.0.0", 12 | "config": "^3.2.5", 13 | "koop-provider-craigslist": "^2.0.1" 14 | }, 15 | "devDependencies": { 16 | "@koopjs/cli": "^0.6.0", 17 | "standard": "^14.3.1", 18 | "tap-spec": "^5.0.0", 19 | "tape": "^5.0.0" 20 | }, 21 | "homepage": "https://github.com/koopjs/koop-app-example", 22 | "keywords": [ 23 | "agol", 24 | "arcgis", 25 | "etl", 26 | "example", 27 | "geojson", 28 | "gis", 29 | "gist", 30 | "github", 31 | "heroku", 32 | "koop", 33 | "postgres", 34 | "sample", 35 | "socrata" 36 | ], 37 | "license": "Apache-2.0", 38 | "main": "src/index.js", 39 | "private": true, 40 | "repository": { 41 | "type": "git", 42 | "url": "https://github.com:koopjs/koop-app-example.git" 43 | }, 44 | "scripts": { 45 | "start": "node src/index.js", 46 | "start:dev": "koop serve --save --watch", 47 | "test": "standard && tape test/*.js | tap-spec" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Koop Sample App 3 | [![Build Status](https://travis-ci.org/koopjs/koop-app-example.svg?branch=master)](https://travis-ci.org/koopjs/koop-app-example) 4 | [![Greenkeeper badge](https://badges.greenkeeper.io/koopjs/koop-app-example.svg)](https://greenkeeper.io/) 5 | 6 | A sample [Koop](https://github.com/koopjs/koop) application with some common [providers](https://koopjs.github.io/docs/providers). 7 | 8 | This app makes it easy to get started running your own instance of Koop. It's also helpful for trying out Koop's functionality and testing providers, caches, plugins, and deployments. 9 | 10 | If you're new to [Node.js](https://nodejs.org/) development, you can read more about [setting up a development environment](https://koopjs.github.io/docs/setup). 11 | 12 | ## Instructions 13 | 14 | Clone this repository on your machine. 15 | 16 | ``` 17 | git clone git@github.com:koopjs/koop-app-example.git 18 | ``` 19 | 20 | Change the working directory to the newly created `koop-app-example` folder. 21 | 22 | ``` 23 | cd koop-app-example 24 | ``` 25 | 26 | Install dependencies. 27 | 28 | ``` 29 | npm install 30 | ``` 31 | 32 | Start the server. 33 | 34 | ``` 35 | npm start 36 | ``` 37 | 38 | Take Koop for a test drive! 39 | 40 | This sample app includes the following providers: 41 | 42 | * [`github`](https://github.com/koopjs/koop-provider-github) 43 | * [`craigslist`](https://github.com/dmfenton/koop-provider-craigslist) 44 | 45 | Once Koop is running, you can test these sample requests: 46 | 47 | * [http://localhost:8080/github/koopjs::geodata::north-america/FeatureServer/0/query](http://localhost:8080/github/koopjs::geodata::north-america/FeatureServer/0/query) 48 | * [http://localhost:8080/craigslist/seattle/apartments/FeatureServer/0/query](http://localhost:8080/craigslist/seattle/apartments/FeatureServer/0/query) 49 | 50 | ## Resources 51 | 52 | * [Koop](https://github.com/koopjs/koop) 53 | * [Koop Documentation](https://koopjs.github.io/docs) 54 | * [PostgreSQL](http://www.postgresql.org/) 55 | * [PostGIS](http://postgis.net/) 56 | * [ArcGIS for Developers](http://developers.arcgis.com) 57 | * [ArcGIS REST API Documentation](http://resources.arcgis.com/en/help/arcgis-rest-api/) 58 | * [@esri](http://twitter.com/esri) 59 | 60 | ## License 61 | 62 | [Apache 2.0](LICENSE) 63 | --------------------------------------------------------------------------------