mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-10 20:38:32 +03:00
change linter to standard
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
import {Router, next} from "express";
|
||||
import {mapboxAccessToken} from "../config";
|
||||
import morgan from "morgan";
|
||||
import mapbox from "./mapbox";
|
||||
import { Router } from 'express'
|
||||
import { mapboxAccessToken } from '../config'
|
||||
import morgan from 'morgan'
|
||||
import mapbox from './mapbox'
|
||||
|
||||
export default ({config, db}) => {
|
||||
let routes = Router();
|
||||
// eslint-disable-next-line
|
||||
export default ({ config, db }) => {
|
||||
let routes = Router()
|
||||
|
||||
/* logging middleware */
|
||||
routes.use(morgan("dev"));
|
||||
routes.use(morgan('dev'))
|
||||
|
||||
if (mapboxAccessToken) {
|
||||
routes.get("/mapbox/:z/:y/:x", mapbox(mapboxAccessToken));
|
||||
routes.get('/mapbox/:z/:y/:x', mapbox(mapboxAccessToken))
|
||||
}
|
||||
|
||||
return routes;
|
||||
};
|
||||
return routes
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import fetch from "node-fetch";
|
||||
import fs from "fs";
|
||||
// TODO: load images from mapbox API and store.
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
const baseUrl = "http://a.tiles.mapbox.com/v4/mapbox.satellite";
|
||||
const baseUrl = 'http://a.tiles.mapbox.com/v4/mapbox.satellite'
|
||||
export default accessToken => (req, res) => {
|
||||
const {x, y, z} = req.params;
|
||||
const { x, y, z } = req.params
|
||||
// const filename = `${z}-${y}-${x}.png`
|
||||
// const fileStream = fs.createWriteStream(`${z}-${y}-${x}.png`)
|
||||
fetch(
|
||||
`http://a.tiles.mapbox.com/v4/mapbox.satellite/${z}/${y}/${x}@2x.png?access_token=${accessToken}`
|
||||
`${baseUrl}/${z}/${y}/${x}@2x.png?access_token=${accessToken}`
|
||||
).then(result => {
|
||||
res.set("Content-Type", "image/png");
|
||||
result.body.pipe(res);
|
||||
});
|
||||
};
|
||||
res.set('Content-Type', 'image/png')
|
||||
result.body.pipe(res)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user