代码拉取完成,页面将自动刷新
var express = require('express');
var https = require('https');
var http = require('http');
var fs = require('fs');
var prettyjson = require('prettyjson');
var multer = require('multer');
var app = express();
app.use(express.static('./'));
app.use(express.static('node_modules'));
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, HEAD, POST, PUT, DELETE, OPTIONS');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, AppKey, Nonce, CurTime, CheckSum');
// res.header('Access-Control-Max-Age', 604800);
res.header('Access-Control-Allow-Credentials', true);
next();
});
// app.use(function (req, res, next) {
// res.status(404).send('404')
// })
app.get('timeout', function (req, res) {
console.log('timeout');
});
var options = {
key: fs.readFileSync('./ssh/key.pem'),
cert: fs.readFileSync('./ssh/cert.pem')
};
var httpServer = http.createServer(app);
httpServer.listen(8182, function () {
console.info('server start at ' + 8182)
logAddress(httpServer, 'http');
});
var httpsServer = https.createServer(options, app);
httpsServer.listen(7182, function () {
logAddress(httpsServer, 'https');
});
function logAddress(server, type) {
var address = server.address();
address = type + '://localhost:' + address.port;
// console.log('vcloud');
// console.log(address + '/webdemo/vcloud/room.html?type=edu&roomid=36168');
log();
}
function log(obj) {
if (!obj) return
if (typeof obj === 'string') {
if (obj.length > 100) {
return;
}
obj = [obj];
}
console.log(prettyjson.render(obj));
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。