hapi.app.server
Version:
A small server to serve up HAPI applications
29 lines (22 loc) • 625 B
text/coffeescript
# Responsibilities
#
# gets variables from a JSON file
fs = require "fs"
class FromJSON
constructor: (, ) ->
= {}
load: ->
try
src = fs.readFileSync , "utf8"
content = JSON.parse src
= content
catch e
getData: (content) ->
return content unless content[] or content["base"]
data = content["base"] or {}
if content[]
data[k] = v for k, v of content[]
data
get: (name) ->
[name]
module.exports = FromJSON