📜  ejs - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:48.439000             🧑  作者: Mango

代码示例6
/*EJS with express
In Express v4, a very basic setup using EJS would look like the following. 
(This assumes a views directory containing an index.ejs page.) */

let express = require('express');
let app = express();

//to set view engine for using EJS
app.set('view engine', 'ejs');

app.get('/', (req, res) => {
  res.render('index', {foo: 'FOO'});
});

app.listen(4000, () => console.log('Example app listening on port 4000!'));