-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (28 loc) · 874 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import express from 'express';
import segmentsRouter from './src/segment.js';
import usersRouter from './src/client.js';
import swaggerJSDoc from 'swagger-jsdoc';
import swaggerUi from 'swagger-ui-express';
const PORT = 8080;
const server = new express;
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Your API',
version: '1.0.0',
},
},
apis: ['./src/segment.js', './src/client.js'], // Укажите пути к вашим маршрутам
};
const swaggerSpec = swaggerJSDoc(options);
server.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
server.use(express.json());
server.use('/segments', segmentsRouter);
server.use('/users', usersRouter);
server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
})
server.get('/test', (req,res) => {
res.status(200).send('Im ok')
})