Skip to content

Commit

Permalink
Enable HTTP/2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerzy committed Dec 18, 2017
1 parent e3850d7 commit db2256e
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 5 deletions.
113 changes: 113 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"name": "bandwidth-hero-proxy",
"main": "server.js",
"private": true,
"version": "1.0.1",
"description":
"Data compression service that converts images to low-res WebP or JPEG on the fly. Used in Bandwidth-Hero browser extension.",
"version": "1.0.2",
"description": "Data compression service that converts images to low-res WebP or JPEG on the fly. Used in Bandwidth-Hero browser extension.",
"author": "Anatoliy Yastreb",
"license": "MIT",
"scripts": {
Expand All @@ -15,7 +14,8 @@
"express": "4.16.2",
"lodash": "^4.17.4",
"request": "^2.83.0",
"sharp": "^0.18.4"
"sharp": "^0.18.4",
"spdy": "^3.4.7"
},
"engines": {
"node": "^8.6.0"
Expand Down
8 changes: 7 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ const app = require('express')()
const authenticate = require('./src/authenticate')
const params = require('./src/params')
const proxy = require('./src/proxy')
const spdy = require('spdy');
const fs = require('fs');
const ssl = {
key: fs.readFileSync('./cert/privkey.pem'),
cert: fs.readFileSync('./cert/fullchain.pem')
}

const PORT = process.env.PORT || 8080

app.enable('trust proxy')
app.get('/', authenticate, params, proxy)
app.get('/favicon.ico', (req, res) => res.status(204).end())
app.listen(PORT, () => console.log(`Listening on ${PORT}`))
spdy.createServer(ssl, app).listen(PORT, () => console.log(`Listening on ${PORT}`))

0 comments on commit db2256e

Please sign in to comment.