Add server config, move plugin file

This commit is contained in:
Michael Jackson
2018-05-17 10:10:33 -07:00
parent 041d0c407f
commit da06a5b97f
6 changed files with 29 additions and 10 deletions

View File

@ -1,9 +1,9 @@
const path = require("path");
const throng = require("throng");
const createServer = require("./server/createServer");
const createDevServer = require("./server/createDevServer");
const port = parseInt(process.env.PORT, 10) || 5000;
const config = require("./server/config");
function startServer(id) {
const server =
@ -15,11 +15,15 @@ function startServer(id) {
: createDevServer(
path.resolve(__dirname, "public"),
require("./webpack.config"),
`http://localhost:${port}`
config.origin
);
server.listen(port, () => {
console.log("Server #%s listening on port %s, Ctrl+C to stop", id, port);
server.listen(config.port, () => {
console.log(
"Server #%s listening on port %s, Ctrl+C to stop",
id,
config.port
);
});
}