Express.js
Express.js organizes how a Node.js server handles web requests. We can assign a route to each action, such as looking up an order or receiving a notification.
What you can build or improve
Receiving external notifications
Create routes that accept events, verify signatures, and record the appropriate changes.
An API for an internal workflow
Expose operations such as assigning a request or adding a comment, with shared validation rules.
When we’d choose it
We’d choose it for a small API or integration that needs a few routes and benefits from choosing its own building blocks.
Why use it
It lets us run shared steps, such as checking a signature or logging errors, before a request reaches the code for a particular route.
What to consider
Express leaves decisions about code structure, input validation, and access control to the team. As the system grows, those rules need to stay consistent.
Illustrative example
Notifications from a delivery provider
A route receives notifications, checks the provider’s signature, and sends the updated order status to the internal system.
Official documentation
Tools and how they fit together
Express lets the team choose how to validate, protect, and test the server’s routes.
Routes and shared steps
Routes and shared steps
Group routes by purpose and reuse steps for identifying requests or handling errors consistently.
- Node.js
- Express Router
Validation and external events
Validation and external events
Check the input before using it. If a provider signs the raw event body, preserve that body so you can verify the signature.
- Zod
- Express Middleware
API testing
API testing
Test successful and failed requests against the routes, including repeated or invalid events.
- Supertest
- Node.js Test Runner
Questions before you decide
What should we decide before creating the routes?
Which apps will use the API, who can take each action, and what response callers receive when they send invalid data.
Do I need Express if I already use Node.js?
No. A simple endpoint can use Node.js directly. Express helps when several routes need shared conventions.
What if an integration provider fails?
Agree on how to record attempts and which actions can be retried without duplicating changes. The team can investigate before replaying an event.