I have the following code as part of app.js and today I upgraded Express from 2.x to 3.x after that I have changed some of the code in my file. Still part of my code is not working. Im using JQTPL as a template engine.
var express = require ('express');
var login = require ('./modules/login');
var config = require ('config');
var app = module.exports = express();
var server = require('http').createServer(app) ;
app.configure(function(){
app.set("view engine", "html");
app.register(".html", require("jqtpl").express);
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
});
server.listen (config.server.port , function ()
{
console.log ('Server started and listening ' + config.server.port);
});
Error that Im getting is
app.register(".html", require("jqtpl").express);
^
TypeError: Object function app(req, res){ app.handle(req, res); } has no method 'register'
at Function.<anonymous> (/home/siva/Work/Applications/TestApp/Explore/TestJQ/app.js:11:9)
at Function.app.configure (/home/siva/node_modules/express/lib/application.js:399:61)
at Object.<anonymous> (/home/siva/Work/Applications/TestApp/Explore/TestJQ/app.js:8:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
The owner of JQTPL does not want to update right away... sad.
https://github.com/coolony/kiwi#express-3x-compatibility Kiwi which seems to use the same syntax did it.
Otherwise you could try this: https://github.com/visionmedia/consolidate.js#express-3x-example