forked from witcher3map/witcher3map
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (21 loc) · 724 Bytes
/
Copy pathserver.js
File metadata and controls
26 lines (21 loc) · 724 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
var express = require('express')
var compression = require('compression')
var app = express()
function shouldCompress(req, res) {
if (req.headers['x-no-compression']) {
// don't compress responses with this request header
return false
}
// fallback to standard filter function
return compression.filter(req, res)
}
// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 80
// compress content with gzip
app.use(compression({filter: shouldCompress}))
// make express look in the dist directory for assets (css/js/img)
app.use(express.static('dist'))
app.listen(port, function() {
console.log('witcher3map is running on http://localhost:' + port)
})