UNPKG

hapi.app.server

Version:

A small server to serve up HAPI applications

21 lines (16 loc) 556 B
Config = require "#{__dirname}/../config" class ConfigIndexVarsMW configure: ({app: app, callback: callback}) -> Config.load() app.get "/", (req, res, next) => req.indexVars ?= {} req.indexVars.config = @getConfigVariables() next() callback?() getConfigVariables: -> assignable = Config.get "assignConfigVariables" or [] vars = {} for key in assignable vars[key] = Config.get key vars module.exports = ConfigIndexVarsMW