-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode8.js
More file actions
28 lines (28 loc) · 689 Bytes
/
node8.js
File metadata and controls
28 lines (28 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Created by lizhen on 2017/11/30.
*/
const port = 3100
const spdy = require('spdy')
const express = require('express')
const path = require('path')
const fs = require('fs')
const app = express()
app.get('*', (req, res) => {
res
.status(200)
.json({message: 'ok'})
})
const options = {
key: fs.readFileSync(__dirname + '/http2Key/server.key'),
cert: fs.readFileSync(__dirname + '/http2Key/server.crt')
}
spdy
.createServer(options, app)
.listen(port, (error) => {
if (error) {
console.error(error)
return process.exit(1)
} else {
console.log('Listening on port: ' + port + '.')
}
})