adapt to latest hafas-rest-api
This commit is contained in:
parent
83a7482767
commit
de11857a7e
1 changed files with 7 additions and 11 deletions
14
index.js
14
index.js
|
@ -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())
|
||||
|
||||
const api = createApi(hafas, config, (api) => {
|
||||
api.get('/stations', stations)
|
||||
api.get('/stations/all', allStations)
|
||||
|
||||
module.exports = api
|
||||
})
|
||||
|
||||
api.listen(config.port, (err) => {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in a new issue