Created
March 13, 2020 16:50
-
-
Save nerik/019ee9c430af9fb06be824aa82c39616 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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