Step 3

Let's take a closer look to the index.js.

In addition to the basic statements to get a NodeJS/Express app up and running (plus static files, and Nunjucks views), we have the following route handlers:

app.get("/", (_req, res) => {
  res.render("index.njk", null);
});

app.get("/dashboard", async (req, res) => {
  const username = req.query.uname;
  const data = {
    nickname: username,
    notes: []
  };
  res.render("dashboard.njk", data);
});

Notice the data passed to the dashboard view contains an empty notes array. We will update this to retrieve the notes for a given author (user) from the YouNote API.