1 Star 0 Fork 0

zengzhaofei/NIM_Web_Demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
twilbeter 提交于 2019-01-24 11:49 . add:recoder
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));
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zjzzf/NIM_Web_Demo.git
git@gitee.com:zjzzf/NIM_Web_Demo.git
zjzzf
NIM_Web_Demo
NIM_Web_Demo
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385