-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
46 lines (35 loc) · 1 KB
/
app.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
34
35
36
37
38
39
40
41
42
43
44
45
const express = require('express');
const bodyParser = require('body-parser');
const swaggerUi = require('swagger-ui-express');
const swaggerJsdoc = require('swagger-jsdoc');
const app = express();
// Middleware to parse JSON requests
app.use(bodyParser.json());
// Swagger setup
const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'Video Distribution API',
version: '1.0.0',
description: 'API for a microservices powered digital distribution platform',
},
servers: [
{
url: 'http://localhost:3000',
},
],
},
apis: ['./routes/*.js'], // Path to your route files
};
const specs = swaggerJsdoc(options);
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));
// Parent router
const appRouter = require('./Router')
app.route(express.json()) ;
app.use('/' , appRouter)
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
module.exports = app; // for testing purposes