Files
tf_provider/PROD_STAND/POSTGRES/testnode/src/openapi-spec.ts
T
2026-06-30 15:46:24 +04:00

24 lines
670 B
TypeScript

import {ApplicationConfig} from '@loopback/core';
import {Loopback4ExampleGithubApplication} from './application';
/**
* Export the OpenAPI spec from the application
*/
async function exportOpenApiSpec(): Promise<void> {
const config: ApplicationConfig = {
rest: {
port: +(process.env.PORT ?? 3000),
host: process.env.HOST ?? 'localhost',
},
};
const outFile = process.argv[2] ?? '';
const app = new Loopback4ExampleGithubApplication(config);
await app.boot();
await app.exportOpenApiSpec(outFile);
}
exportOpenApiSpec().catch(err => {
console.error('Fail to export OpenAPI spec from the application.', err);
process.exit(1);
});