adapt to latest hafas-rest-api

This commit is contained in:
Jannis R 2018-01-09 16:42:30 +01:00
parent 83a7482767
commit de11857a7e
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -2,7 +2,6 @@
const hafas = require('db-hafas')
const createApi = require('hafas-rest-api')
const createLogging = require('hafas-rest-api/logging')
const hsts = require('hsts')
const pkg = require('./package.json')
@ -10,20 +9,17 @@ const stations = require('./lib/stations')
const allStations = require('./lib/all-stations')
const config = {
hostname: process.env.HOSTNAME || '1.db.transport.rest',
hostname: process.env.HOSTNAME || '2.db.transport.rest',
port: process.env.PORT || 3000,
name: pkg.name,
homepage: pkg.homepage
homepage: pkg.homepage,
logging: true
}
const api = createApi(hafas, config)
api.use(createLogging())
api.get('/stations', stations)
api.get('/stations/all', allStations)
module.exports = api
const api = createApi(hafas, config, (api) => {
api.get('/stations', stations)
api.get('/stations/all', allStations)
})
api.listen(config.port, (err) => {
if (err) {