node.js - Get variable values in HTML from the Hogan-express module -
js , express.js, trying title value in html express-hogan template not getting required output on html element,i ran app.js in node , (running on localhost-port:3000)on browser ,here code express(app.js):
var express = require('express'), app = express(), path = require('path'); app.set('views', path.join(__dirname, 'views')); app.engine('html', require('hogan-express')); app.set('view engine', 'html'); app.use(express.static(path.join(__dirname, 'public'))); app.route('/').get(function(req, res, next) { res.render('index', { title: 'welcome chatkat' }); }) app.listen(3000, function() { console.log('chatkat running on por t 3000');
following html view:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>{{title}}</title> </head> <body> <div class="hm-container"> <h1 class="hm-title">my face book login</h1> <a href="#"><img src="images/facebook26.png"></a> </h1> </div> </body> </html>
and package.json:
{ "name": "chatkat", "version": "1.0.0", "description": "", "main": "index.js", "dependencies": { "express": "^4.13.4", "hogan-express": "^0.5.2", "passport": "^0.2.0", "passport-facebook": "^1.0.3", "qr-image": "^3.1.0", "socket.io": "^1.4.4" }, "devdependencies": { "express": "~4.2.0", "hogan-express": "~0.5.2" }, "scripts": { "test": "echo \"error: no test specified\" && exit 1" }, "author": "", "license": "isc" }
Comments
Post a Comment