49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
|
|
import { fileURLToPath } from "node:url";
|
||
|
|
import path from "path";
|
||
|
|
import { configs } from "./app/configs";
|
||
|
|
import { accountSwaggerDocs } from "./app/modules/account/account.swagger";
|
||
|
|
import { profileSwaggerDocs } from "./app/modules/profile/profile.swagger";
|
||
|
|
|
||
|
|
const __filename = fileURLToPath(import.meta.url);
|
||
|
|
const __dirname = path.dirname(__filename);
|
||
|
|
|
||
|
|
export const swaggerOptions = {
|
||
|
|
definition: {
|
||
|
|
openapi: "3.0.0",
|
||
|
|
info: {
|
||
|
|
title: "API Doc - Build with exp-node-server",
|
||
|
|
version: "1.0.0",
|
||
|
|
description: "Express + Prisma API with auto-generated Swagger docs",
|
||
|
|
},
|
||
|
|
paths: {
|
||
|
|
...accountSwaggerDocs,
|
||
|
|
...profileSwaggerDocs,
|
||
|
|
},
|
||
|
|
servers:
|
||
|
|
configs.env === "production"
|
||
|
|
? [{ url: "https://live-url.com" }, { url: "http://localhost:5000" }]
|
||
|
|
: [{ url: "http://localhost:5000" }, { url: "https://live-url.com" }],
|
||
|
|
components: {
|
||
|
|
securitySchemes: {
|
||
|
|
AuthorizationToken: {
|
||
|
|
type: "apiKey",
|
||
|
|
in: "header",
|
||
|
|
name: "Authorization",
|
||
|
|
description: "Put your accessToken here ",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
security: [
|
||
|
|
{
|
||
|
|
AuthorizationToken: [],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
apis: [
|
||
|
|
path.join(
|
||
|
|
__dirname,
|
||
|
|
configs.env === "production" ? "./**/*.js" : "./**/*.ts",
|
||
|
|
),
|
||
|
|
],
|
||
|
|
};
|