integrated CoC pull from bookstack
This commit is contained in:
@@ -10,6 +10,24 @@ import { assignUserToStatus } from '../services/statusService';
|
||||
import { Request, response, Response } from 'express';
|
||||
import { getUserRoles } from '../services/rolesService';
|
||||
|
||||
//get CoC
|
||||
router.get('/coc', async (req: Request, res: Response) => {
|
||||
const output = await fetch(`${process.env.DOC_HOST}/api/pages/714`, {
|
||||
headers: {
|
||||
Authorization: `Token ${process.env.DOC_TOKEN_ID}:${process.env.DOC_TOKEN_SECRET}`,
|
||||
}
|
||||
})
|
||||
|
||||
if (output.ok) {
|
||||
const out = await output.json();
|
||||
res.status(200).json(out.html);
|
||||
} else {
|
||||
console.error("Failed to fetch LOA policy from bookstack");
|
||||
res.sendStatus(500);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// POST /application
|
||||
router.post('/', async (req, res) => {
|
||||
try {
|
||||
@@ -283,20 +301,5 @@ router.post('/restart', async (req: Request, res: Response) => {
|
||||
}
|
||||
})
|
||||
|
||||
// router.get('/coc', async (req: Request, res: Response) => {
|
||||
// const output = await fetch(`${process.env.DOC_HOST}/api/pages/`, {
|
||||
// headers: {
|
||||
// Authorization: `Token ${process.env.DOC_TOKEN_ID}:${process.env.DOC_TOKEN_SECRET}`,
|
||||
// }
|
||||
// })
|
||||
|
||||
// if (output.ok) {
|
||||
// const out = await output.json();
|
||||
// res.status(200).json(out.html);
|
||||
// } else {
|
||||
// console.error("Failed to fetch LOA policy from bookstack");
|
||||
// res.sendStatus(500);
|
||||
// }
|
||||
// })
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user