Snippets

代码片段收集板

edit

日期:

作者: 小胡子哥


title: 具有 ejs layout 的 express generator —-

// app.js
var express = require('express');
var expressLayouts = require('express-ejs-layouts');
var app = express();
var path = require('path');

app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname, 'public')));
// 必须放在 static 设置的后面
app.use(expressLayouts);
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta lang="zh">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="description" content="">
    <meta name="keyword" content="">
    <title>DEMO</title>
    <link rel="stylesheet" href="/main.css">
  </head>
  <body>
    <%- body %>
    <script src="/main.js"></script>
  </body>
</html>
标签:

loading...

这网速真是弱爆了...客官稍等,评论还在加载~