nodejs express jade application

From WebHostingNeeds.com
Jump to: navigation, search

You need to install jade template engine.

npm install jade

Now you can use jade templates in your express.js application.

[email protected]:~/www/expressApp $ cat app.js 
var express = require('express');
var app = express();

app.get('/', function(req, res) {
    res.render('index.jade');
});

app.listen(3000, function() {
    console.log("Application listening on port 3000");
});


[email protected]:~/www/expressApp $ cat views/index.jade 
h1 Test
[email protected]:~/www/expressApp $ 



nodejs