1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const core_1 = require("@nestjs/core");
|
4 | const abstract_loader_1 = require("./loaders/abstract.loader");
|
5 | const express_loader_1 = require("./loaders/express.loader");
|
6 | const fastify_loader_1 = require("./loaders/fastify.loader");
|
7 | const noop_loader_1 = require("./loaders/noop.loader");
|
8 | exports.serveStaticProviders = [
|
9 | {
|
10 | provide: abstract_loader_1.AbstractLoader,
|
11 | useFactory: (httpAdapterHost) => {
|
12 | if (!httpAdapterHost) {
|
13 | return new noop_loader_1.NoopLoader();
|
14 | }
|
15 | const httpAdapter = httpAdapterHost.httpAdapter;
|
16 | if (httpAdapter &&
|
17 | httpAdapter.constructor &&
|
18 | httpAdapter.constructor.name === 'FastifyAdapter') {
|
19 | return new fastify_loader_1.FastifyLoader();
|
20 | }
|
21 | return new express_loader_1.ExpressLoader();
|
22 | },
|
23 | inject: [core_1.HttpAdapterHost],
|
24 | },
|
25 | ];
|