@@ -65,10 +65,24 @@ serve({
6565 // Multiple folders to serve from
6666 contentBase: [' dist' , ' static' ],
6767
68+ // URL root path to serve the static content at
69+ contentBasePublicPath: ' /' ,
70+
71+ // Customize serving of static files, see https://expressjs.com/en/resources/middleware/serve-static.html
72+ staticOptions: {},
73+
74+ // Set to true to enable the default compression, or to an object to customize the compression
75+ // according to https://expressjs.com/en/resources/middleware/compression.html
76+ compress: false ,
77+
78+ // Set to true to enable directory indexes, or to an object to customize the index generation
79+ // according to https://expressjs.com/en/resources/middleware/serve-index.html
80+ serveIndex: false ,
81+
6882 // Set to true to return index.html (200) instead of error page (404)
6983 historyApiFallback: false ,
7084
71- // Path to fallback page
85+ // Path to fallback page, see also https://github.com/bripkens/connect-history-api-fallback
7286 historyApiFallback: ' /200.html' ,
7387
7488 // Options used in setting up server
@@ -82,18 +96,38 @@ serve({
8296 ca: fs .readFileSync (' /path/to/ca.pem' )
8397 },
8498
85- // set headers
99+ // Set additional headers
86100 headers: {
87101 ' Access-Control-Allow-Origin' : ' *' ,
88102 foo: ' bar'
89103 },
90104
91- // set custom mime types, usage https://github.com/broofa/mime#mimedefinetypemap-force--false
105+ // Set custom mime types, usage https://github.com/broofa/mime#mimedefinetypemap-force--false
92106 mimeTypes: {
93107 ' application/javascript' : [' js_commonjs-proxy' ]
94- }
108+ },
109+
110+ // Let requests to /api/* be forwarded to http://localhost:3000/*
111+ // See the full documentation at https://webpack.js.org/configuration/dev-server/#devserverproxy
112+ proxy: [
113+ {
114+ context: [' /api' ],
115+ target: ' http://localhost:3000' ,
116+ pathRewrite: { ' ^/api' : ' ' },
117+ },
118+ ],
119+
120+ // Customize the Express instance before all middlewares are installed
121+ before : function (app ) {
122+ ...
123+ },
124+
125+ // Customize the Express instance after all middlewares are installed
126+ after : function (app ) {
127+ ...
128+ },
95129
96- // execute function after server has begun listening
130+ // Execute function after server has begun listening
97131 onListening : function (server ) {
98132 const address = server .address ()
99133 const host = address .address === ' ::' ? ' localhost' : address .address
0 commit comments