Skip to content

Instantly share code, notes, and snippets.

Created Jun 26, 2012
What would you like to do?
Node.js data sharing between server and client
//Client side
app.get('/trends', function(req, res){
twitterProcessor.getTrends( function(error, trendData){
res.render('trends.jade',{ locals: {
trends:trendData // here's the data you pass to client
//Client side
var data =!{JSON.stringify(trends)}
//And this is how it will see in the browser
<script type="text/javascript">
var data = []; // your data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment