]>
Commit | Line | Data |
---|---|---|
1 | import * as express from 'express' | |
2 | import { UserRight } from '../../../../shared/models/users' | |
3 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' | |
4 | ||
5 | const debugRouter = express.Router() | |
6 | ||
7 | debugRouter.get('/debug', | |
8 | authenticate, | |
9 | ensureUserHasRight(UserRight.MANAGE_DEBUG), | |
10 | asyncMiddleware(getDebug) | |
11 | ) | |
12 | ||
13 | // --------------------------------------------------------------------------- | |
14 | ||
15 | export { | |
16 | debugRouter | |
17 | } | |
18 | ||
19 | // --------------------------------------------------------------------------- | |
20 | ||
21 | async function getDebug (req: express.Request, res: express.Response) { | |
22 | return res.json({ | |
23 | ip: req.ip | |
24 | }).end() | |
25 | } |