Permalink
Browse files

adds cors (#5)

  • Loading branch information...
normanrz committed Oct 28, 2018
1 parent edb7012 commit bbebf5345924d2b5b9ec740d0699ba64f203af68
Showing with 36 additions and 2 deletions.
  1. +5 −2 index.js
  2. +1 −0 package.json
  3. +30 −0 yarn.lock
@@ -1,6 +1,7 @@
const { json, send } = require("micro");
const limitedMap = require("limited-map");
const query = require("micro-query");
const cors = require("micro-cors")();
const { FileTileSet, S3TileSet } = require("./tileset");

const cacheSize = process.env.TILE_SET_CACHE || 128;
@@ -57,7 +58,7 @@ async function handleGETStatus(req, res) {
return send(res, 200, "Ok");
}

module.exports = async (req, res) => {
async function handler(req, res) {
switch (req.method) {
case "POST":
return handlePOST(req, res);
@@ -70,4 +71,6 @@ module.exports = async (req, res) => {
default:
return send(res, 405, { error: "Only GET or POST allowed" });
}
};
}

module.exports = cors(handler);
@@ -13,6 +13,7 @@
"limited-map": "^0.0.1",
"lru-memoize": "^1.0.2",
"micro": "^9.3.2",
"micro-cors": "^0.1.1",
"micro-query": "^0.3.0"
},
"devDependencies": {

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit bbebf53

Please sign in to comment.