forked from CindyJS/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserve.js
More file actions
30 lines (26 loc) · 673 Bytes
/
serve.js
File metadata and controls
30 lines (26 loc) · 673 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
"use strict";
var http = require("http");
var url = require("url");
var express = require("express");
var app = express();
var isGulp = process.argv[2] === "--gulp";
app.use(express.static("build"));
var port = 80;
var host = "127.0.0.1";
var server = http.createServer(app);
server.listen(port, host);
if (isGulp) {
server.on("listening", function() {
var a = server.address();
process.send({
host: a.address,
port: a.port,
url: url.format({
protocol: "http",
hostname: a.address,
port: a.port,
pathname: "/",
}),
});
});
}