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

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more