@mridang/nestjs-auth
Version:
A comprehensive Auth.js integration for NestJS applications with TypeScript support, framework-agnostic HTTP adapters, and role-based access control
20 lines • 680 B
JavaScript
import { ExpressAdapter } from '../adapters/express.adapter.js';
import { FastifyAdapter } from '../adapters/fastify.adapter.js';
/**
* Factory to create the appropriate HTTP adapter based on the
* underlying HTTP server being used.
*/
export class AdapterFactory {
static create(adapterHost) {
const kind = adapterHost.httpAdapter.getType();
switch (kind) {
case 'express':
return new ExpressAdapter();
case 'fastify':
return new FastifyAdapter();
default:
throw new Error(`Unsupported HTTP adapter: ${kind}`);
}
}
}
//# sourceMappingURL=adapter.factory.js.map