Backend development

Stage 1 · Lesson 5 of 10

Promises and async/await

Your language and how HTTP works

A backend spends most of its time waiting for other things: the database, another service, a file or . So almost every call it makes is , which means the answer comes later. A is a placeholder for a value that arrives later.

An async function always returns one. await pauses that one function until the promise finishes, without stopping the rest of the server. Errors from awaited calls are caught with an ordinary try/catch.

Learn Promise.all to run independent calls at the same time, and Promise.allSettled for when some of them may fail.

Common trapThe traps are forgetting await, so the error escapes your try/catch and the code carries on with an unfinished promise. The other is awaiting inside a loop when the calls do not depend on each other, which turns ten 50 ms calls into ms instead of about 50.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking JavaScript Fundamentals

    Design Gurus · Beginner · $50

    JavaScript itself in a sensible order: scope, closures, promises and async code

  • GuideFree
    Node.js Learn

    OpenJS Foundation · Beginner

    Official guides on the event loop, async work, the http module and environment variables

Practise

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Read Everyday Types and Narrowing first, then keep it open while you write TypeScript

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?