I'm working on a data analytics dashboard in Node.js as a portfolio piece. I've built a pipeline that gets the data where it needs to be for more processing, however, I feel the below code can be improved but it overlaps with my inexperience with Node.js and async/await.
The below code looks redundant to my eye. I tried to move the second function into the first in an anonymous async function to no avail, and was wondering if the more experience members here had any suggestions?
async function readFilteredStream() {
filteredStream = streamConnect(); //Connects to API
const results = await readStream(filteredStream); //Reads in a sample of data and closes the connection.
return { data: results };
}
async function respondWithSamples() {
const results = await readFilteredStream();
return results;
}