Skip to content

Rossoline/express-learn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express in the Small 🚂

Build a real, typed REST API with Express 5 the hands-on way: 9 test-driven blocks in strict TypeScript, validated with Zod, tested with Node's built-in node:test runner. ~1.5–2 weeks.

Node 22+ Express 5 TypeScript Zod License: MIT Use this template

You don't read about Express — you implement routes, middleware, and handlers, make failing tests pass, and type every handler properly. From block 05 you build a REST API for a simple domain (tasks / notes / bookmarks), in memory, growing to a capstone.

🧩 Third in a series: TypeScript in a Month · Node.js in a Month · Express in the Small.

Why this course

  • 🧪 Test-driven — every block ships failing tests; you make them green by hitting a real app with fetch.
  • 🔒 Strict TypeScript — typed handlers via RequestHandler<Params, ResBody, ReqBody, Query> and Zod-inferred types.
  • 🧱 Express 5 — modern routing and automatic async error handling.
  • Verified solutions — every reference answer is itself tested (npm run test:solutions).
  • 🛠️ Project-driven — fundamentals lead into a multi-resource REST API.

Quick start

git clone https://github.com/Rossoline/express-learn.git
cd express-learn
npm install            # Node 22+ required
npm test               # most fail until you solve the exercises
npm run typecheck

Work a block, then run just its tests:

node --import tsx --test "blocks/01-getting-started/tests/*.test.ts"
npm run play blocks/01-getting-started/src/examples.ts

Curriculum

The full plan is in PLAN.md.

Part Blocks
Fundamentals 01 Getting Started · 02 Routing · 03 Middleware & lifecycle · 04 Request & Response (typed handlers)
REST · validation · errors 05 REST & the tasks resource · 06 Validation with Zod · 07 Error handling
Project 08 Multi-resource API (capstone) · 09 Testing & polish (stretch)

What's in each block

blocks/NN-topic/
├── README.md          # the topic explained, with examples and the exercise list
├── src/examples.ts    # a runnable worked example
├── src/exercises.ts   # practice tasks with // TODO stubs — your job
├── tests/             # node:test tests (real fetch) — make them pass
└── solutions/         # reference solutions (try the exercises first!)

Scripts

Command What it does
npm test Run every block's tests.
npm run typecheck Type-check the whole project.
npm run test:solutions Verify the reference solutions all pass.
npm run play <file> Run any .ts file with tsx.

If this helped you learn Express, please ⭐ the repo. Happy routing! 🚂

About

Learn Express 5 in ~2 weeks: build a typed REST API (tasks/notes/bookmarks) with Zod validation, hands-on and test-driven in strict TypeScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors