MCPcopy Create free account
hub / github.com/PSPDFKit/nutrient-document-engine-mcp-server / dashboardHandler

Function dashboardHandler

src/dashboard/routes.ts:38–64  ·  view source on GitHub ↗
(client: DocumentEngineClient, req: Request, res: Response)

Source from the content-addressed store, hash-verified

36 * Dashboard home page handler
37 */
38export async function dashboardHandler(client: DocumentEngineClient, req: Request, res: Response) {
39 try {
40 // Get list of documents
41 const response = await client['list-documents']({
42 page_size: 100,
43 order_by: 'created_at',
44 order_direction: 'desc',
45 });
46
47 const documents = response.data.data || [];
48
49 // Get message from query parameters if present
50 const message = req.query.message as string | undefined;
51
52 // Render HTML dashboard
53 res.send(dashboardTemplate(documents, formatFileSize, message));
54 } catch (error) {
55 logger.error(null, 'Dashboard error', { error });
56 res
57 .status(500)
58 .send(
59 errorTemplate(
60 `An error occurred while loading the dashboard: ${error instanceof Error ? error.message : 'Unknown error'}`
61 )
62 );
63 }
64}
65
66/**
67 * File upload handler

Callers 1

createDashboardRouterFunction · 0.85

Calls 3

dashboardTemplateFunction · 0.85
errorTemplateFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected