-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
37 lines (29 loc) · 970 Bytes
/
server.js
File metadata and controls
37 lines (29 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"use strict";
//*********************************
// NOTE: this is not used. was experimenting.
//*********************************
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config.js');
var express = require('express');
var proxy = require('proxy-middleware');
var url = require('url');
// -------- proxy----------------------
var app = express();
// proxy the request for static assets
app.use('/assets', proxy(url.parse('http://localhost:8081/assets')));
app.get('/*', function(req, res) {
res.sendFile(__dirname + '/src/public/index.html');
});
// -----webpack-dev-server------------------
var server = new WebpackDevServer(webpack(config), {
contentBase: 'src/public/',
hot: true,
quiet: false,
noInfo: false,
publicPath: "/",
historyApiFallback: true,
stats: { colors: true }
});
server.listen(8081, "localhost", function() {});
app.listen(8080);