var express = require('express'); var app = express(); var open = require("open"); app.get('/', function (req, res) { res.send('Hello World!'); }); open("http://127.0.0.1:3000"); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); });
示例代码如上
转载于:https://my.oschina/u/2362045/blog/1510100
var express = require('express'); var app = express(); var open = require("open"); app.get('/', function (req, res) { res.send('Hello World!'); }); open("http://127.0.0.1:3000"); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); });
示例代码如上
转载于:https://my.oschina/u/2362045/blog/1510100