Skip to content

Instantly share code, notes, and snippets.

@vvasc
Created November 14, 2023 18:13
Show Gist options
  • Save vvasc/34bb4cad11497628aa056a138094ff63 to your computer and use it in GitHub Desktop.
Save vvasc/34bb4cad11497628aa056a138094ff63 to your computer and use it in GitHub Desktop.
const dbQuery = (query) => {
 return new Promise( (resolve, reject) => {
   setTimeout( ()=> { resolve(`Results for db query: ${query}`) }, 1000 * Math.floor(5*Math.random()) );
 } )
}
const queries = ['Query 1', 'Query 2', 'Query 3', 'Query 4', 'Query 5'];

// Fix this snippet of code so that it prints the query results
queries.forEach( q => console.log(dbQuery(q)) );

Live Coding Test: Express.js Integration Challenge

Objective:

Your task is to demonstrate your skills in backend development using Express.js by integrating two external APIs and creating new endpoints with specific functionalities.

Starting Point:

Access the provided sandbox link containing a simple Express.js server setup: Express API Sandbox. Integration Task: https://codesandbox.io/p/sandbox/simple-express-server-forked-6sjsjq?file=%2Fsrc%2Findex.js%3A21%2C30

API Integration:

You will integrate two external endpoints:

Tasks

  1. Retrieve and combine data from both APIs.
  2. Structure the final output so that each album includes all its related photos. The structure should be intuitive and easy to navigate. Endpoint Creation:
  3. Develop a new endpoint within the Express.js application. This endpoint should accept an id as a request parameter. It will filter and return the album corresponding to the passed id, along with its related photos.

Expectations:

  • Code Quality: Write clean, efficient, and well-documented code.
  • Error Handling: Implement proper error handling for external API calls and data processing.
  • Correctness of the integration and data merging.
  • Efficiency of the solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment