UNPKG

hapi.app.server

Version:

A small server to serve up HAPI applications

29 lines (22 loc) 625 B
# Responsibilities # # gets variables from a JSON file fs = require "fs" class FromJSON constructor: (@filePath, @env) -> @data = {} load: -> try src = fs.readFileSync @filePath, "utf8" content = JSON.parse src @data = @getData content catch e getData: (content) -> return content unless content[@env] or content["base"] data = content["base"] or {} if content[@env] data[k] = v for k, v of content[@env] data get: (name) -> @data[name] module.exports = FromJSON