Commit d874874b authored by 何硕's avatar 何硕

test wss

parent 3287db50
var express = require('express');
var app = express();
app.use('/wss', express.static(__dirname));
// var server = app.listen(3001, function(){
// console.log('http listening on *:3001');
// });
// app.use('/wss', express.static(__dirname ));
var http = require('http').createServer(app);
var https = require("https");
// var https = require("https");
var axios = require('axios');
// var io = require('socket.io').listen(server);
var io = require('socket.io')(http);
let fs = require("fs");
// let fs = require("fs");
// app.all('*', function(req, res, next) {
// res.header("Access-Control-Allow-Origin", "*");
......@@ -30,10 +27,10 @@ var BaseUrl = "https://zhibo.xueyoubangedu.com/api/";
// cert: fs.readFileSync("./https/fullchain.pem")
// }
const httpsOption = {
key : fs.readFileSync("./https/zhibo.xueyoubangedu.com.key"),
cert: fs.readFileSync("./https/zhibo.xueyoubangedu.com.pem")
}
// const httpsOption = {
// key : fs.readFileSync("./https/zhibo.xueyoubangedu.com.key"),
// cert: fs.readFileSync("./https/zhibo.xueyoubangedu.com.pem")
// }
app.get('/', function(req, res){
res.send('<h1>Hello world</h1>');
......@@ -123,6 +120,6 @@ http.listen(3001, function(){
});
https.createServer(httpsOption, app).listen(3000, function(){
console.log('https listening on *:3000');
});
\ No newline at end of file
// https.createServer(httpsOption, app).listen(3000, function(){
// console.log('https listening on *:3000');
// });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment