StaffCoder
Node.js
4 modules · 16 challengesSign up
Module 4 of 4 · 4 challenges

Node.js (TypeScript) Middleware Basics

Write the shared steps that wrap every request - logging, access control, timing through an injected dependency rather than a hard-coded one, and compose them in front of the routes. Log method/path/final-status/duration, gate writes by token and scope (401/403), stamp a latency header, and stack them all in front of a data-backed API with paged, injection-safe queries. Covers logging, authentication/authorization, timing, and middleware composition.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Request Audit Log

Sign up to unlock
—No data yeteasy
About this challenge

A billing service that logs nothing, so failures can't be traced. A shared step records who asked for what and how it ended errors included - while skipping the health-check noise.

Solved in a browser IDE and graded by tests. Sign up to solve

Admin Console Access Gate

Sign up to unlock
—No data yeteasy
About this challenge

A back-office console whose write actions are open to anyone with the link. A shared gate checks the caller's token and permissions before the action runs, and lets read-only and public pages through.

Solved in a browser IDE and graded by tests. Sign up to solve

Checkout Latency Header

Sign up to unlock
—No data yeteasy
About this challenge

An engineering team can't see which checkout steps are slow. A shared step times each request and reports the duration back on the response, for both successes and failures.

Solved in a browser IDE and graded by tests. Sign up to solve

Contact Activity API

STAR
Solving it completes the module
—No data yeteasy
About this challenge

A sales CRM's contact-activity feed behind one guarded, logged surface. Reads are paged and safe from injection, writes are blocked unless authorised, and every call is recorded.

Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.