Skip to content

Instantly share code, notes, and snippets.

@nerik
Created March 13, 2020 16:50
Show Gist options
  • Save nerik/019ee9c430af9fb06be824aa82c39616 to your computer and use it in GitHub Desktop.
Save nerik/019ee9c430af9fb06be824aa82c39616 to your computer and use it in GitHub Desktop.
var path = require('path')
var express = require('express')
var app = express()
var cors = require('cors')
const PORT = 9090
console.log(`on port ${PORT}`)
app.use(cors())
app.use(function(req, res, next) {
var ext = path.extname(req.url)
if (ext !== '.png' && !req.url.match('fonts')) {
res.setHeader('Content-Encoding', 'gzip')
}
next()
})
const tilePath = path.join(__dirname, '../tiles')
console.log(tilePath)
app.use(express.static(tilePath))
app.listen(PORT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment