forked from Tab-nabbers/Tab-Nabbers2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverDev.js
40 lines (25 loc) · 853 Bytes
/
serverDev.js
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
var express = require('express'),
secret = require("./back/config/secrets"),
path = require("path"),
webpack = require("webpack"),
open = require("open");
var config = require("./webpack.config");
var app = express(),
PORT = process.env.PORT || 3000;
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
noInfo:true,
publicPath:config.output.publicPath
}));
app.use(require('webpack-hot-middleware')(compiler));
// // Static directory
app.use(express.static(path.join(__dirname + "/app/public")));
app.get("*", function (req, res) {
res.sendFile(path.join(__dirname, '/front/public/index.html'));
});
app.listen(PORT, function(err) {
if (!err)
console.log("Site is live");
else console.log("Database started fine!!!");
});
open(`http://localhost:${PORT}`);