-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (27 loc) · 1.04 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// clean shutdown on `cntrl + c`
process.on('SIGINT', () => process.exit(0))
process.on('SIGTERM', () => process.exit(0))
// Initialize Koop
const Koop = require('koop')
const koop = new Koop()
// Install the Sample Provider
const provider = require('./')
koop.register(provider)
if (process.env.DEPLOY === 'export') {
module.exports = koop.server
} else {
// Start listening for HTTP traffic
const config = require('config')
// Set port for configuration or fall back to default
const port = config.port || 8080
koop.server.listen(port)
const message = `
Koop Sample Provider listening on ${port}
For more docs visit: https://koopjs.github.io/docs/specs/provider/
To find providers visit: https://www.npmjs.com/search?q=koop+provider
Try it out in your browser: http://localhost:${port}/socrata/data.sfgov.org/tmnf-yvry/FeatureServer/0/query
Or on the command line: curl --silent http://localhost:${port}/socrata/data.sfgov.org/tmnf-yvry/FeatureServer/0/query?returnCountOnly=true
Press control + c to exit
`
console.log(message)
}