forked from freyhill/react-multi-page-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwww.js
More file actions
33 lines (26 loc) · 710 Bytes
/
www.js
File metadata and controls
33 lines (26 loc) · 710 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
31
32
33
/* eslint-env node */
/**
* @file: 线上启动程序
* @author: leinov
* @date: 2018-10-10
*/
var express = require("express");
var app = express();
var http = require("http");
var port = "3118";
//在浏览器中打开 下面执行
const opn = require("opn");
//启动压缩
var compression = require("compression");
app.use(compression());
//静态页面路径
app.use(express.static("./build"));
app.set("port", port);
//启动server
var server = http.createServer(app);
server.listen(port);
server.on("listening", onListening);
function onListening() {
console.log(`server port 3118 listening and open browser with http://localhost:${port}....` );
opn(`http://localhost:${port}`,"chrome");
}