import type { HttpContext } from '@adonisjs/core/http'; import type { NextFn } from '@adonisjs/core/types/http'; export default class StardustMiddleware { async handle(ctx: HttpContext, next: NextFn): Promise { /** * Middleware logic goes here (before the next call) */ // console.log(ctx); const { pathname } = new URL(ctx.request.completeUrl()); globalThis.stardust = { ...globalThis.stardust, pathname, }; /** * Call next method in the pipeline and return its output */ const output = await next(); return output; } } // import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; // export default class StardustMiddleware { // handle({ request }: HttpContextContract, next: () => Promise): Promise; // }