No description or website provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
test
.gitignore
.testem.json
.travis.yml
LICENCE
README.md
get.js
index.js
package.json

README.md

json-globals

build status dependency status

Embed JSON in a page as temporary global data

Example for the server

var JSONGlobals = require("json-globals")

function (req, res) {
    getUser(req, res, function (userRecord) {
        var text = JSONGlobals({ user: userRecord })
        var html = "" // whatever html

        html += "<script>" + text + "</script>"

        res.end(html)
    })
}

Example for the client

var JSONGlobals = require("json-globals/get")

var user = JSONGlobals("user")

Installation

npm install json-globals

Contributors

  • Raynos

MIT Licenced