File tree 3 files changed +137
-98
lines changed
3 files changed +137
-98
lines changed Original file line number Diff line number Diff line change 23
23
},
24
24
"dependencies" : {
25
25
"@koa/cors" : " ^2.2.2" ,
26
- "colors-cli" : " ^1.0.17 " ,
26
+ "colors-cli" : " ^1.0.18 " ,
27
27
"dayjs" : " ^1.7.5" ,
28
28
"fs-extra" : " ^7.0.0" ,
29
29
"git-side-band-message" : " 0.0.3" ,
36
36
"koa-logger" : " ^3.2.0" ,
37
37
"koa-router" : " ^7.4.0" ,
38
38
"koa-static" : " ^5.0.0" ,
39
- "koa-view " : " ^2 .1.1 " ,
39
+ "koa-views " : " ^6 .1.4 " ,
40
40
"local-ip-url" : " ^1.0.1" ,
41
41
"mime" : " ^2.3.1" ,
42
42
"nodegit" : " ^0.22.2" ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const bodyParser = require('koa-bodyparser');
8
8
const koaBody = require ( 'koa-body' ) ;
9
9
const session = require ( 'koa-generic-session' ) ;
10
10
const SequelizeStore = require ( 'koa-generic-session-sequelize' ) ;
11
- const view = require ( 'koa-view ' ) ;
11
+ const view = require ( 'koa-views ' ) ;
12
12
const static = require ( 'koa-static' ) ;
13
13
const prepareUrls = require ( 'local-ip-url/prepareUrls' ) ;
14
14
require ( 'colors-cli/toxic' )
@@ -35,12 +35,16 @@ app.use(session({
35
35
proxy : true // if you do SSL outside of node.
36
36
} ) ) ;
37
37
38
+ const publicPath = path . join ( process . cwd ( ) , 'public' ) ;
39
+
38
40
app . use ( cors ( ) ) ;
39
41
app . use ( koaBody ( ) ) ;
40
42
app . use ( bodyParser ( ) ) ;
41
43
app . use ( json ( ) ) ;
42
- app . use ( view ( path . join ( process . cwd ( ) , 'public' ) ) ) ;
43
- app . use ( static ( path . join ( __dirname , '..' , 'public' ) ) ) ;
44
+ app . use ( view ( publicPath , {
45
+ extension : 'html'
46
+ } ) ) ;
47
+ app . use ( static ( publicPath ) ) ;
44
48
45
49
// 忽略打印资源加载
46
50
function ignoreAssets ( mw ) {
You can’t perform that action at this time.
0 commit comments