mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 02:06:34 +02:00
17 lines
544 B
TypeScript
17 lines
544 B
TypeScript
import type { IncomingMessage, ServerResponse } from "http";
|
|
import { getIronSession } from "iron-session";
|
|
import { withIronSessionApiRoute } from "iron-session/next";
|
|
import { NextApiHandler } from "next";
|
|
|
|
import { sessionConfig } from "../session-config";
|
|
|
|
export function withSessionRoute(handler: NextApiHandler) {
|
|
return withIronSessionApiRoute(handler, sessionConfig);
|
|
}
|
|
|
|
export const getSession = async (
|
|
req: Request | IncomingMessage,
|
|
res: Response | ServerResponse,
|
|
) => {
|
|
return getIronSession(req, res, sessionConfig);
|
|
};
|