sheetaki/api/file/index.js

13 lines
399 B
JavaScript
Raw Normal View History

const URL = require('url');
fs = require('fs');
2021-05-03 18:58:45 +00:00
const { getFile } = require('../s3');
module.exports = function (req, res) {
res.setHeader('Access-Control-Allow-Origin', '*');
const url = URL.parse(req.url, true);
if (!url.query.filename) return res.status(400).send("Must specify filename");
if (url.query.filename){
2021-05-03 18:58:45 +00:00
getFile(req, res, url, url.query.filename);
}
};