For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /apis/app/hooks/server/server.md.

modern.server.ts

This file extends the Modern.js Server. In this file, you can configure Middleware, RenderMiddleware, or Plugin for the Server that starts with the Modern.js project.

You can intercept and handle requests and responses, perform authentication and role checks, preprocess requests, and handle exceptions, etc. You can also insert specific business logic into the built-in processing logic (including route matching, resource addressing, header injection, page rendering, and static web hosting).