This repository was archived by the owner on Dec 14, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +268
-87
lines changed Expand file tree Collapse file tree 3 files changed +268
-87
lines changed Original file line number Diff line number Diff line change
1
+ const express = require ( 'express' ) ;
2
+ const path = require ( 'path' ) ;
3
+
4
+ const port = 8080 ;
5
+ const app = express ( ) ;
6
+
7
+ // serve static assets normally
8
+ app . use ( express . static ( path . resolve ( __dirname , 'dist' ) ) ) ;
9
+
10
+ // block known api route causing looping redirect
11
+ app . get ( '/rpi/*' , ( request , response ) => {
12
+ response . send ( 'fin.' ) ;
13
+ } ) ;
14
+
15
+ // handle every other route with index.html
16
+ app . get ( '*' , ( request , response ) => {
17
+ response . sendFile ( path . resolve ( __dirname , 'dist/index.html' ) ) ;
18
+ } ) ;
19
+
20
+ app . listen ( port ) ;
Original file line number Diff line number Diff line change 16
16
"test" : " yarn unit && yarn e2e-with-mocks" ,
17
17
"lint" : " eslint --ext .js,.vue src test/unit/specs" ,
18
18
"mock-server" : " node ./json-server/server.js" ,
19
- "cypress" : " yarn build && concurrently --kill-others --success first \" http-server dist/ --push-state > /dev/null\" \" cypress run --browser chrome\" " ,
19
+ "cypress" : " yarn build && concurrently --kill-others --success first \" node cypress-spa-server.js > /dev/null\" \" cypress run --browser chrome\" " ,
20
20
"cypress:open" : " cypress open" ,
21
21
"cypress:e2e" : " cypress open --config-file cypress-e2e.json" ,
22
22
"cypress:install" : " cypress install"
81
81
"eslint-plugin-import" : " ^2.2.0" ,
82
82
"eventsource-polyfill" : " ^0.9.6" ,
83
83
"extract-text-webpack-plugin" : " ^2.0.0" ,
84
+ "express" : " ^4.17.1" ,
84
85
"file-loader" : " ^0.11.1" ,
85
86
"friendly-errors-webpack-plugin" : " ^1.1.3" ,
86
87
"html-webpack-plugin" : " ^2.28.0" ,
113
114
"shelljs" : " ^0.7.6" ,
114
115
"sinon" : " ^7.3.2" ,
115
116
"sinon-chai" : " ^3.2.0" ,
116
- "spa-http-server" : " ^0.9.0" ,
117
117
"speed-measure-webpack-plugin" : " ^1.3.1" ,
118
118
"timeshift-js" : " ^1.0.1" ,
119
119
"url-loader" : " ^0.5.8" ,
You can’t perform that action at this time.
0 commit comments