File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 9
9
"author" : " " ,
10
10
"license" : " ISC" ,
11
11
"dependencies" : {
12
+ "koa-connect-history-api-fallback" : " ^0.3.1" ,
12
13
"http-proxy-middleware" : " ^0.18.0" ,
13
14
"koa" : " ^2.5.0" ,
14
15
"koa-send" : " ^4.1.3" ,
Original file line number Diff line number Diff line change @@ -3,9 +3,29 @@ const path = require('path')
3
3
const Static = require ( 'koa-static' )
4
4
const proxy = require ( 'http-proxy-middleware' )
5
5
const send = require ( 'koa-send' )
6
+ const history = require ( 'koa-connect-history-api-fallback' )
6
7
7
8
const app = new Koa ( )
8
9
10
+ app . use ( history ( {
11
+ verbose : true ,
12
+ disableDotRule : true ,
13
+ rewrites : [
14
+ {
15
+ from : / .c s s $ / ,
16
+ to : function ( context ) {
17
+ return '' + context . parsedUrl . pathname . slice ( - 17 )
18
+ }
19
+ } ,
20
+ {
21
+ from : / .j s $ / ,
22
+ to : function ( context ) {
23
+ return '' + context . parsedUrl . pathname . slice ( - 16 )
24
+ }
25
+ }
26
+ ]
27
+ } ) )
28
+
9
29
const Public = Static ( path . join ( __dirname , '../dist' ) )
10
30
app . use ( Public )
11
31
You can’t perform that action at this time.
0 commit comments