Skip to content

Colingo/json-globals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published