-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.js
25 lines (22 loc) · 820 Bytes
/
server.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
//Required to support babel's inline sourcemaps
require("source-map-support").install();
require("babel-register")({
//See: https://babeljs.io/docs/usage/options/#options
ignore: /node_modules/,
presets: [["modern-node", { version: "6.0.0" }], "react", "stage-0"],
sourceMaps: "both",
babelrc: false //Do not use babelrc
});
const parrotSay = require("parrotsay-api");
const app = require("./src/server").default;
const host = process.env.HOST || process.env.NODE_ENV == "production"
? "0.0.0.0"
: "127.0.0.1";
const port = parseInt(process.env.PORT) || process.env.NODE_ENV == "production"
? 80
: 3000;
require("dns").lookup(require("os").hostname(), function(err, add, fam) {
app.listen(port, host, () =>
parrotSay(`Listening at ${add} (${host}) on port ${port}`).then(console.log)
);
});