Middleware
Middleware runs before a page or endpoint renders, and can read or change the request and response.
import { defineMiddleware } from 'halite:middleware';
export const onRequest = defineMiddleware(async (context, next) => {
context.locals.startedAt = Date.now();
return next();
});Updated
Was this page helpful?