Knowledgebase

Building APIs With Express Print

  • backenddevelopment, backend, errors, security, troubleshooting, guide, howto, solution
  • 0

The established framework.

WHAT IT PROVIDES

Routing Middleware Request and response helpers

WHAT IT DOES NOT PROVIDE

Structure Validation An ORM Opinions

WHAT THAT MEANS

You assemble the application yourself, which is flexible and inconsistent across projects.

WHAT TO ADD FIRST

Body parsing Security headers Request logging with identifiers A validation library Centralised error handling

WHAT ORDER MATTERS FOR

Middleware, which runs in the order registered.

WHAT TO REGISTER LAST

The error handler, so it catches everything before it.

WHAT TO AVOID

Business logic inside route handlers Handlers hundreds of lines long Duplicated validation

WHAT TO ORGANISE

Routes into modules by feature, mounted under a prefix.

WHAT TO BE CAREFUL WITH IN ASYNCHRONOUS HANDLERS

Errors not reaching the error handler automatically in older versions.

WHAT TO DO ABOUT IT

Wrap handlers, or use a version handling it.

WHAT TO SET

Request timeouts Body size limits Rate limits on authentication endpoints


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot