-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
bugSomething isn't workingSomething isn't working
Description
As the title suggests I am trying to pull MSOA level endpoint data via axios within nodejs, as described by the api's documentation.
The error message has been attached within a .txt file
Code used:
const axios = require("axios");
const surreyRates_endpoint = (
`https://api.coronavirus.data.gov.uk/v1/data?` +
`filters=areaType=msoa;areaCode=E02006427` +
`&structure={"date":"date","rate":"newCasesBySpecimenDateRollingRate"}`
);
const surreyRates_getData = async ( url ) => {
const { data, status, statusText } = await axios.get(url, { timeout: 20000 });
if ( status >= 400 )
throw new Error(statusText);
return data
}; // getData
const surreyRates_main = async () => {
const result = await surreyRates_getData(surreyRates_endpoint);
const data_values = Object.values(result)[3];
console.log(data_values)
}; // main
surreyRates_main().catch(err => {
console.error(err);
process.exitCode = 1;
});
Module is being tested on a windows 10 machine
Final combined back end code will be run of a windows 2019 server
The module will be looped over a number of MSOAs within surrey, but for simplicity, code for just a single MSOA has been provided. If there is a flaw in my code please advise, however this code template has worked for all other modules within our larger conglomerate of back end code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working