feat: app.use api docs

This commit is contained in:
karishmas6
2024-10-28 23:12:12 +05:30
parent 2cb6708efa
commit 285b9441ec

View File

@@ -15,6 +15,9 @@ import { SERVER_PORT } from "./constants/config";
import { Server } from "socket.io";
import { readdirSync } from "fs"
import { fork } from 'child_process';
import captureServerAnalytics from "./utils/analytics";
import swaggerUi from 'swagger-ui-express';
import swaggerSpec from './swagger/config';
const app = express();
app.use(cors({
@@ -47,6 +50,7 @@ app.use('/storage', storage);
app.use('/auth', auth);
app.use('/integration', integration);
app.use('/proxy', proxy);
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
readdirSync(path.join(__dirname, 'api')).forEach((r) => {
const route = require(path.join(__dirname, 'api', r));
@@ -73,6 +77,10 @@ workerProcess.on('exit', (code) => {
});
app.get('/', function (req, res) {
captureServerAnalytics.capture({
distinctId: 'maxun-oss-server-run',
event: 'server_started',
});
return res.send('Maxun server started 🚀');
});