From de11857a7ed5219d8ef66c3008944dfd0a0c8718 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 9 Jan 2018 16:42:30 +0100 Subject: [PATCH] adapt to latest hafas-rest-api --- index.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 6fda9d3..d01ce21 100644 --- a/index.js +++ b/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()) - -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) {