We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app.get('/', (req, res, next) => { let temp = fs.readFileSync('./index.html', {encoding: 'utf8'}); res.send(temp); });
app.set('view engine', 'ejs'); // 设置使用的模版引擎:ejs 【测试了一下,这一步不用也可以】 app.set('views', path.join(__dirname, 'views')); // ejs 模板位置,不设置的话,默认目录是 views app.get('/', (req, res, next) => { res.render('index.ejs', {title: '首页'}); // index.ejs 要放到 views });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
引入 html 模板的方式:
引入 ejs 模板的方式
The text was updated successfully, but these errors were encountered: