HeliumTS is under active development and may have bugs or breaking changes. Report issues on GitHub.

Middleware

You can define a middleware to intercept requests to the server.

src/server/_middleware.ts

1import { middleware } from "heliumts/server";
2
3export default middleware(async (ctx, next) => {
4 console.log("Request received");
5 // Add your database connection or auth logic here
6 await next();
7 //You can even add code after the request is handled
8 console.log("Request ended");
9});