Docs
Guide
Server Entry
Server Entry
You can define a server entry file to directly access the server instance.
If a file named server.entry.{ts|js} exists in the project root directory, Dobs will automatically load and execute it as the server entry.
Typescript
import type { BaseServer } from "@dobsjs/http";
export default (server: BaseServer) => {
server.use((req, res, next) => next());
};#Custom Entry
You can specify a custom server entry file:
Typescript
import { defineConfig } from "dobs";
export default defineConfig({
serverEntry: "./my-entry.ts",
});#Execution Order
The server entry is executed when the server is first created, before any middleware is added. This allows you to interact with the server in its initial state.
- Run plugins
- Execute server entry
- Apply
config.middlewares - Register router middleware