fix endpoint not found

This commit is contained in:
Nitwel
2020-10-05 10:42:00 +02:00
parent bc6582186f
commit 8ae6afb4da

View File

@@ -1,17 +1,21 @@
import { Router } from 'express';
import { ServerService } from '../services';
import { SpecificationService } from '../services'
import { SpecificationService } from '../services';
import asyncHandler from 'express-async-handler';
import { respond } from '../middleware/respond';
const router = Router();
router.get('/specs/oas', asyncHandler(async (req, res, next) => {
const url = req.protocol + '://' + req.get('host') + '/'
const service = new SpecificationService(url, {accountability: req.accountability})
res.locals.payload = await service.generateOAS();
return next()
}));
router.get(
'/specs/oas',
asyncHandler(async (req, res, next) => {
const url = req.protocol + '://' + req.get('host') + '/';
const service = new SpecificationService(url, { accountability: req.accountability });
res.locals.payload = await service.generateOAS();
return next();
}),
respond
);
router.get('/ping', (req, res) => res.send('pong'));