Skip to content

Commit

Permalink
add routes for SOI pdfs and tiffs
Browse files Browse the repository at this point in the history
  • Loading branch information
ramSeraph committed Feb 27, 2025
1 parent 80bfa84 commit c202138
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/soi_ancillary_routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fetch = require('node-fetch');

const ancillaryUrl = 'https://github.com/ramSeraph/opendata/releases/download/soi-ancillary/';
const releaseBaseUrl = 'https://github.com/ramSeraph/opendata/releases/download';

function getCorsProxyFn(targetUrl, request, reply) {
return async function(request, reply) {
Expand All @@ -12,8 +12,10 @@ function getCorsProxyFn(targetUrl, request, reply) {
}

function addSOIAncillaryRoutes(fastify) {
fastify.get('/soi/osm/index.geojson', getCorsProxyFn(ancillaryUrl + 'index.geojson'));
fastify.get('/soi/india_boundary.geojson', getCorsProxyFn(ancillaryUrl + 'polymap15m_area.geojson'));
fastify.get('/soi/osm/index.geojson', getCorsProxyFn(`${releaseBaseUrl}/soi-ancillary/index.geojson`));
fastify.get('/soi/india_boundary.geojson', getCorsProxyFn(`${releaseBaseUrl}/soi-ancillary/polymap15m_area.geojson`));
fastify.get('/soi/pdf_list.txt', getCorsProxyFn(`${releaseBaseUrl}/soi-pdfs/list.txt`));
fastify.get('/soi/tiff_list.txt', getCorsProxyFn(`${releaseBaseUrl}/soi-tiffs/list.txt`));
}

module.exports = addSOIAncillaryRoutes;

0 comments on commit c202138

Please sign in to comment.