Skip to content

Commit af354c8

Browse files
author
jrclber
committed
new documentation
1 parent f70dbbf commit af354c8

3 files changed

Lines changed: 22 additions & 11 deletions

File tree

docs/swagger.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ tags:
9696
description: Chatbot platform for creating virtual assistants.
9797
- name: Typebot > Sessions
9898
description: Management of chatbot sessions on the Typebot platform.
99+
100+
servers:
101+
- url: https://{{prod_host}}
102+
variables:
103+
prod_host:
104+
default: apiv1.codechat.dev
105+
- url: http://{{dev_host}}
106+
variables:
107+
dev_host:
108+
default: 127.0.0.1:8084
109+
99110
paths:
100111
/instance/qrcode/{instanceName}:
101112
get:

src/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ import { MessageRouter } from './whatsapp/routers/sendMessage.router';
6565
import { GroupRouter } from './whatsapp/routers/group.router';
6666
import { WebhookRouter } from './whatsapp/routers/webhook.router';
6767
import session from 'express-session';
68-
import { swaggerRouter } from './config/swagger.config';
6968
import { ROOT_DIR } from './config/path.config';
7069
import { join } from 'path';
7170
import { LoggerMiddleware } from './middle/logger.middle';
7271
import { InstanceGuard } from './guards/instance.guard';
7372
import { JwtGuard } from './guards/auth.guard';
7473
import { ErrorMiddle } from './middle/error.middle';
7574
import 'express-async-errors';
75+
import { docsRouter } from './config/scala.config';
7676

7777
export function describeRoutes(
7878
rootPath: string,
@@ -215,7 +215,7 @@ export async function AppModule(context: Map<string, any>) {
215215

216216
app.use('/', router);
217217

218-
app.use(swaggerRouter);
218+
app.use(docsRouter);
219219

220220
app.use(ErrorMiddle.appError, ErrorMiddle.pageNotFound);
221221

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* ┌──────────────────────────────────────────────────────────────────────────────┐
33
* │ @author jrCleber │
4-
* │ @filename main.ts
4+
* │ @filename scala.config
55
* │ Developed by: Cleber Wilson │
66
* │ Creation date: Aug 13, 2023 │
77
* │ Contact: contato@codechat.dev │
@@ -33,18 +33,18 @@
3333

3434
import { Router } from 'express';
3535
import { join } from 'path';
36-
import swaggerUi from 'swagger-ui-express';
3736
import YAML from 'yamljs';
38-
39-
const document = YAML.load(join(process.cwd(), 'docs', 'swagger.yaml'));
37+
import { apiReference } from '@scalar/express-api-reference';
4038

4139
const router = Router();
4240

43-
export const swaggerRouter = router.use('/docs', swaggerUi.serve).get(
41+
export const docsRouter = router.use(
4442
'/docs',
45-
swaggerUi.setup(document, {
46-
customCssUrl: '/css/dark-theme-swagger.css',
47-
customSiteTitle: 'CodeChat - WhatsApp API',
48-
customfavIcon: '/images/logo.png',
43+
apiReference({
44+
spec: {
45+
content() {
46+
return YAML.load(join(process.cwd(), 'docs', 'swagger.yaml'));
47+
},
48+
},
4949
}),
5050
);

0 commit comments

Comments
 (0)