diff --git a/functions/datasets/datasets.js b/functions/datasets/datasets.js index 51e996af64da66c9f169e099566f1adfa5f33305..c2fc5262d4107d18b4119e10f895de23e48cbdb2 100644 --- a/functions/datasets/datasets.js +++ b/functions/datasets/datasets.js @@ -1,5 +1,4 @@ const CACHED_DATASET_URL = process.env.CACHED_DATASET_URL -const got = require('got') exports.handler = (ev, ctx, cb) => { const { path, @@ -18,14 +17,12 @@ exports.handler = (ev, ctx, cb) => { const [ _, templateName, parcellationName ] = re if (CACHED_DATASET_URL) { - got(CACHED_DATASET_URL) - .then(text => cb(null, { - status: 200, - body: text, - headers: { - 'content-type': 'application/json' - } - })) + cb(null, { + status: 302, + headers: { + 'Location': CACHED_DATASET_URL + } + }) } else { return cb(null, { status: 200, diff --git a/functions/datasets/package.json b/functions/datasets/package.json deleted file mode 100644 index 12fef8e07e605c6dbe751bcc26143648b2ced7fa..0000000000000000000000000000000000000000 --- a/functions/datasets/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "datasets", - "version": "1.0.0", - "description": "", - "main": "datasets.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "apache-2.0", - "dependencies": { - "got": "^11.1.4" - } -} diff --git a/netlify.toml b/netlify.toml index d845c6f2229438976aad13ea1b54051c8cf84752..a13f3209ddc97124cb12ca7c9a811beaad48d3dd 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,6 +2,6 @@ [build] publish="dist/aot/" - command="cp deploy/util/* functions/nehubaConfig/ && cp -R src/res/ext functions/templates/json && cp -R src/res/ext functions/nehubaConfig/json && npm run build-aot && cd functions/datasets && npm i" + command="cp deploy/util/* functions/nehubaConfig/ && cp -R src/res/ext functions/templates/json && cp -R src/res/ext functions/nehubaConfig/json && npm run build-aot" functions="functions" environment={ BACKEND_URL=".netlify/functions/" } \ No newline at end of file