baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax
http://ectjs.com
MIT License
627 stars 70 forks source link

ExpressJS sample code #109

Open margani opened 3 years ago

margani commented 3 years ago

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?