Luccas Mateus 20ac80a5e8
Example of how to create a data portal in 5 minutes (#769)
* [example][m] - start of a simple-example

* Empty-Commit

* [simple-example][sm] - change from repos.json to datasets.json

* [example][m] - changed styling and added octokit

* [build][sm] - fix build
2023-04-18 13:51:48 -03:00

27 lines
511 B
TypeScript

import axios from "axios";
export default function handler(req, res) {
if (!req.query.url) {
res.status(200).send({
error: true,
info: "No url to proxy in query string i.e. ?url=...",
});
return;
}
axios({
method: "get",
url: req.query.url,
responseType: "stream",
})
.then((resp) => {
resp.data.pipe(res);
})
.catch((err) => {
res.status(400).send({
error: true,
info: err.message,
detailed: err,
});
});
}