You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/src/http/kernel/module/PersistSessionHTTPModule.ts

19 lines
584 B

import {HTTPKernelModule} from "../HTTPKernelModule";
import {Injectable} from "@extollo/di"
import {HTTPKernel} from "../HTTPKernel";
import {Request} from "../../lifecycle/Request";
import {Session} from "../../session/Session";
@Injectable()
export class PersistSessionHTTPModule extends HTTPKernelModule {
public static register(kernel: HTTPKernel) {
kernel.register(this).last()
}
public async apply(request: Request): Promise<Request> {
const session = <Session> request.make(Session)
await session.persist()
return request
}
}