baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax

Home Page:http://ectjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExpressJS sample code

margani opened this issue · comments

I had to add the following to the sample code to make it work:

app.set('views', path.join(__dirname, "views"));

Here is the sample code for using with express:

var express = require('express');
var app = express();
var ECT = require('ect');
var ectRenderer = ECT({ watch: true, root: __dirname + '/views', ext : '.ect' });

app.set('view engine', 'ect');
app.engine('ect', ectRenderer.render);

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

app.listen(3000);
console.log('Listening on port 3000');

Shall we update it?