-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhttp.js
More file actions
26 lines (21 loc) · 902 Bytes
/
http.js
File metadata and controls
26 lines (21 loc) · 902 Bytes
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
import { Router } from "express";
import { logErrors, logRequests } from "shared/middleware.js";
import { createCmsAgentsRouter } from "./http/agents.js";
import { createCmsConversationsRouter } from "./http/conversations.js";
import { createCmsSearchRouter } from "./http/search.js";
import { createCmsToolsRouter } from "./http/tools.js";
export { createCmsAgentsRouter } from "./http/agents.js";
export { createCmsConversationsRouter } from "./http/conversations.js";
export function createCmsRouter({ application } = {}) {
if (!application) {
throw new Error("cms application is required");
}
const v1 = Router();
v1.use(logRequests());
v1.use(createCmsAgentsRouter({ application }));
v1.use(createCmsConversationsRouter({ application }));
v1.use(createCmsToolsRouter({ application }));
v1.use(createCmsSearchRouter({ application }));
v1.use(logErrors());
return v1;
}