Published
Edited
Feb 4, 2022
2 forks
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
proxy = deploy(
"proxy",
async (request, response, context) => {
const format_url = (x) => x;
const base_url =
"http://openapi.data.go.kr/openapi/service/rest/Covid19/getCovid19SidoInfStateJson";

const key = context.secrets["endpointservices_example_secret"];
const date1 = format_url(request.query.start);
const date2 = format_url(request.query.end);

const xml_url = `${base_url}?serviceKey=${encodeURIComponent(
key
)}&startCreateDt=${date1}&endCreateDt=${date2}`;

// Sometimes its enough to debug intermediate steps by returning information via the response.
// return response.send(xml_url)

const apiResponse = await fetch(xml_url);

response.status(apiResponse.status).send(await apiResponse.text());
},
{
secrets: ["endpointservices_example_secret"]
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
proxyResponse = fetch(`${proxy.href}?start=20200101&end=20200201`)
Insert cell
proxyResponse.text()
Insert cell
proxyResponse.status
Insert cell
Insert cell
Insert cell
footer
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more