Node and Express are the runtime and HTTP framework for your API. Topics here cover bootstrapping the app, parsing JSON bodies, and structured logging—everything that runs before a route handler executes. Master this layer first so later routers and controllers plug into a consistent foundation.

How Promises work in backend code — Basic

A Promise represents async work that will finish later (database, file, network). Knex queries return promises; Express handlers use async/await to read results cleanly.
Learn: Before async/await, Promises were the standard way to handle async results in Node. Knex still returns a Promise from every query builder chain. Understanding then/catch helps you read older examples; writing new code with async/await is usually clearer in controllers and services.

Supplementary examples

Promise.all for parallel queries

const [users, pastes] = await Promise.all([
  knex("users").select("*"),
  knex("pastes").select("*"),
]);

Course example

// Knex returns a Promise
const promise = knex("users").select("*");

promise
  .then((rows) => console.log(rows))
  .catch((err) => console.error(err));

// Same query with async/await (preferred in controllers/services)
async function listUsers() {
  const rows = await knex("users").select("*");
  return rows;
}

Additional references & examples

← All Async and await in Express · Node / Express