Authored by happyhour7

初始化文件

1 var express = require('express'); 1 var express = require('express');
2 var path = require('path'); 2 var path = require('path');
3 -var ejs = require('ejs'); 3 +var ejs = require('hbs');
4 var favicon = require('serve-favicon'); 4 var favicon = require('serve-favicon');
5 var logger = require('morgan'); 5 var logger = require('morgan');
6 var cookieParser = require('cookie-parser'); 6 var cookieParser = require('cookie-parser');
@@ -14,20 +14,22 @@ var app = express(); @@ -14,20 +14,22 @@ var app = express();
14 14
15 // view engine setup 15 // view engine setup
16 app.set('views', path.join(__dirname, 'views')); 16 app.set('views', path.join(__dirname, 'views'));
17 -app.engine('.html', ejs.__express); 17 +app.engine('html', ejs.__express);
18 app.set('view engine', 'html'); 18 app.set('view engine', 'html');
19 19
20 // uncomment after placing your favicon in /public 20 // uncomment after placing your favicon in /public
21 app.use(favicon(__dirname + '/public/favicon.ico')); 21 app.use(favicon(__dirname + '/public/favicon.ico'));
22 -app.use(logger('dev')); 22 +
23 app.use(bodyParser.json()); 23 app.use(bodyParser.json());
  24 +
24 app.use(bodyParser.urlencoded({ extended: false })); 25 app.use(bodyParser.urlencoded({ extended: false }));
  26 +
25 app.use(cookieParser()); 27 app.use(cookieParser());
26 -app.use(partials()); 28 +
27 app.use(pjax()); 29 app.use(pjax());
28 app.use(express.static(path.join(__dirname, 'public'))); 30 app.use(express.static(path.join(__dirname, 'public')));
29 31
30 -app.use(init.ReadConFigFile()); 32 + app.use(init.ReadConFigFile());
31 33
32 init.init(app); 34 init.init(app);
33 35
@@ -8,8 +8,7 @@ @@ -8,8 +8,7 @@
8 <link rel="stylesheet" type="text/css" href="http://localhost:8000/dist/yohogirls-frontend-web/0.0.1/girls.css" /> 8 <link rel="stylesheet" type="text/css" href="http://localhost:8000/dist/yohogirls-frontend-web/0.0.1/girls.css" />
9 </head> 9 </head>
10 <body> 10 <body>
11 - <%-body%>  
12 - </body> 11 + {{{body}}}
13 <script type="text/javascript" src="http://localhost:8000/dist/yohogirls-frontend-web/0.0.1/seajs.js?nowrap"></script> 12 <script type="text/javascript" src="http://localhost:8000/dist/yohogirls-frontend-web/0.0.1/seajs.js?nowrap"></script>
  13 + </body>
14 </html> 14 </html>
15 -