json-globals

Embed JSON in a page as temporary global data

json-globals

Embed JSON in a page as temporary global data

var JSONGlobals = require("json-globals")
 
function (reqres) {
    getUser(req, res, function (userRecord) {
        var text = JSONGlobals({ user: userRecord })
        var html = "" // whatever html 
 
        html += "<script>" + text + "</script>"
 
        res.end(html)
    })
}
var JSONGlobals = require("json-globals/get")
 
var user = JSONGlobals("user")

npm install json-globals

  • Raynos