All files / src app.ts

100% Statements 29/29
100% Branches 0/0
100% Functions 0/0
100% Lines 29/29

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 291x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
import express from 'express';
import authRoutes from './routes/auth_routes';
import commentsRoutes from './routes/comments_routes';
import postsRoutes from './routes/posts_routes';
import usersRoutes from './routes/users_routes';
import swaggerUi from 'swagger-ui-express';
import swaggerJsdoc from 'swagger-jsdoc';
import options from './docs/swagger_options';
import authenticateToken from "./middleware/auth";
 
const specs = swaggerJsdoc(options);
 
const app = express();
 
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));
 
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
 
app.use(authenticateToken.unless({ path: ['/auth/login', '/auth/register', '/auth/refresh-token'] }));
 
 
app.use('/auth', authRoutes);
app.use('/comments', commentsRoutes);
app.use('/posts', postsRoutes);
app.use('/users', usersRoutes);
 
export default app;