javascript - Make the variables in Node module usable by jQuery, Ember, etc -


I am really new in the backend world, and I have a node module (called apjs) Accessed by Javascript module. If he counts, then he is called MonoDB.

By now I can only send data () as the boring plain text on the page. I want to be able to manipulate this data for other purposes (such as creating a table) So how can I pass these variables in JavaScript, and so I can display them properly in HTML?

You can use res.render to present data with Express and Z, it Express and Z: looks like res.render ('yourView', {data: yourVariable}

.send is where to go. That should be either with an app initialization (app.js) or in an external file like (router.js), then your app is fed.

Then, in the template used as a web page, You can make a list like this:

  # {data}   

or you can create a list like this (if you use Z Each data li = data in rows

is expected that this is what is for you, and it helps: D.

The example of an AP JS can look like now:

  var express = require ('express'); Var requires http =' ('http') ; Var bodyParser = is required ('body-parser'); Var methodoverride = is required ('method override'); Var routes = required ('. / Path') (app); Var path = requirement ('path'); Var app = express (); App.configure (function () (app.set ('port', process.env.port || 3000); app.set ('views', __dirname + '/ views'); app.set ('view engine' , 'Jade'); App Usage (BodyParser.Urlencoded ({Extended: True}) App Usage (BodyPaster .Jason ()) App Use (Method Override); App. Usage (Express.Static (Path) (__ dirname, 'public'))}}}}} ap gate ('/', function (rik, riz) {res.render ('home', {title: "Welcome to an example site" }};}); Http.createServer (list) .listen (('3000'), function () {console.log ('server online');});    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -