Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
45 lines (37 loc) · 992 Bytes

File metadata and controls

45 lines (37 loc) · 992 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
38
39
40
41
42
43
44
45
var path = require("path");
var express = require("express");
var webpack = require("webpack");
var config = require("./webpack.config");
var _ = require("lodash");
var app = express();
var compiler = webpack(config);
//for logging
var morgan = require("morgan");
//serve satic files form
app.use(express.static("./src/client/assets"));
app.use(
require("webpack-dev-middleware")(compiler, {
noInfo: true,
publicPath: config.output.publicPath,
watchOptions: {
aggregateTimeout: 300,
poll: true,
}
})
);
app.use(require("webpack-hot-middleware")(compiler));
// use morgan to log requests to the console
app.use(morgan("dev"));
app.get("*", function(req, res) {
if (_.endsWith(req.originalUrl, ".css")) {
res.setHeader("content-type", "text/css");
}
res.sendFile(path.join(__dirname, "./src/client/index.html"));
});
app.listen(4000, "localhost", function(err) {
if (err) {
console.log(err);
return;
}
console.log("Listening at http://localhost:4000/");
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.