Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0a99c40
move legacy nodejs week 2 to backend nodejs week1
marcorichetta Aug 22, 2025
cef7825
follow new modules naming
marcorichetta Aug 22, 2025
94e6b26
move legacy nodejs week3 to backend nodejs week2
marcorichetta Aug 22, 2025
47351d0
chore: refreshed links removed stale code
magdazelena Sep 9, 2025
0fe5ace
chore: scaffold teacher materials
magdazelena Sep 15, 2025
76d2984
chore: add info about parameters
magdazelena Sep 15, 2025
a3187a2
chore: add route order example
magdazelena Sep 15, 2025
4bd0fac
Update courses/backend/node/week1/assignment.md
magdazelena Oct 6, 2025
887a414
Update courses/backend/node/week1/session-materials/01-server.md
magdazelena Oct 6, 2025
c60a940
Update courses/backend/node/week1/session-materials/02-schema.md
magdazelena Oct 6, 2025
b2175a2
chore: add middleware code
magdazelena Oct 6, 2025
c5c14e6
chore: move week2 to a separate PR
magdazelena Oct 6, 2025
2f96c60
chore: translated sql to sqlite
magdazelena Oct 8, 2025
d1ecddc
chore: reorder content
magdazelena Oct 8, 2025
6cca8f8
chore: remove items from readme, refresh prep links
magdazelena Oct 8, 2025
b71c754
chore: update links
magdazelena Oct 8, 2025
bbec7d4
Apply suggestions from code review
magdazelena Oct 27, 2025
c71f822
chore: updated the assignment to remove meal sharing
magdazelena Oct 27, 2025
a518901
chore: add more on authentication
magdazelena Oct 27, 2025
765b8d6
chore: fix linting
magdazelena Oct 27, 2025
4468cea
Update courses/backend/node/week1/assignment.md
adamblanchard Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions courses/backend/node/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Node
# Node.js

Coming soon
This module is part of the Backend specialism and focuses on using Node.js to build backend services, APIs, and databases. It builds on the Introduction to Backend module from Foundation with more advanced tooling, patterns, and responsibilities.

## Contents

| Week | Topic | Preparation | Lesson Plan | Assignment |
| ---- | ------------------------ | ----------------------------------- | ----------------------------------- | ------------------------------------- |
| 1. | Express | [Preparation](week1/preparation.md) | [Assignment](./week1/assignment.md) | [Session plan](week1/session-plan.md) |
| 2. | Database connection; API | [Preparation](week2/preparation.md) | [Assignment](./week1/assignment.md) | [Session plan](week2/session-plan.md) |

## Module Learning Goals

By the end of this module, you will be able to:

- [ ] Build web servers with Express.js
- [ ] Design and implement APIs using HTTP methods following REST principles
- [ ] Use middlewares for authentication, logging, and validation
- [ ] Test APIs using Postman
- [ ] Use logging and debugging tools to monitor and troubleshoot applications
- [ ] Connect to databases and implement CRUD operations
15 changes: 15 additions & 0 deletions courses/backend/node/module-materials/examples/middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import express from "express";
const app = express();

app.use((req, _res, next) => {
console.log(req.headers["accept-language"]);
const isFromDenmark = req.headers["accept-language"].includes("da");
console.log(isFromDenmark);
req.isFromDenmark = isFromDenmark;

next();
});

app.listen(3000, function () {
console.log(`> Ready on http://localhost:3000`);
});
20 changes: 20 additions & 0 deletions courses/backend/node/module-materials/examples/parameters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import express from "express";
const app = express();

// query parameters
// http://localhost:3000/query-parameters?hej=23,%20sd-p
app.get("/query-parameters", (req, res) => {
console.log(req.query);
res.send({ data: req.query });
});

// URL parameters
// http://localhost:3000/parameters/apple-eater
app.get("/parameters/:username", (req, res) => {
console.log(req.params);
res.send({ data: req.params });
});

app.listen(3000, function () {
console.log(`> Ready on http://localhost:3000`);
});
26 changes: 26 additions & 0 deletions courses/backend/node/module-materials/examples/route-order.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import express from "express";
const app = express();

app.get("/data", (_req, res) => {
res.send({ data: 1 });
});

app.get("/data", (_req, res) => {
res.send({ data: 2 });
});

// Which one is being called when?

app.get("/data/:id", (req, res) => {
console.log("Parametrized URL");
res.send({ data: req.params });
});

app.get("/data/overview", (req, res) => {
console.log("Overview");
res.send({ data: req.params });
});

app.listen(3000, function () {
console.log(`> Ready on http://localhost:3000`);
});
8 changes: 8 additions & 0 deletions courses/backend/node/module-materials/examples/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import express from "express";
const router = express.Router();

router.get("/", async (_request, response) => {
response.send({ data: "from app.use" });
});

export default router;
14 changes: 14 additions & 0 deletions courses/backend/node/module-materials/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import express from "express";
import router from "./examples/router.js";

const app = express();

app.get("/", (_req, res) => {
res.send({ data: "from app.get" });
});

app.use("/use", router);

app.listen(3000, function () {
console.log(`> Ready on http://localhost:3000`);
});
Loading