///
type ServerSession = {
handle: (arg: {
req: Request;
handle: (req: Request) => Promise;
mode: "dev" | "prod";
url: {
raw: URL;
pathname: string;
};
}) => Promise;
};
export const sessionServer = (arg: {
encrypt?: boolean;
on: {
login: (arg: {
mode: "user-pass";
username: string;
password: string;
}) => Promise;
};
}): ServerSession => {
const s: ServerSession = {
async handle({ req, handle, mode, url }) {
if (url.pathname.startsWith("/_session")) {
return new Response("marjio");
}
return await handle(req);
},
};
return s;
};