Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liveserver
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何硕
liveserver
Commits
d874874b
Commit
d874874b
authored
Aug 15, 2019
by
何硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test wss
parent
3287db50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
index.js
index.js
+11
-14
No files found.
index.js
View file @
d874874b
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment