From d2c5b2de6711351df5947ebd4004c1fbbc659628 Mon Sep 17 00:00:00 2001 From: SaelixCode Date: Wed, 18 Mar 2026 11:53:41 -0400 Subject: [PATCH] fix: cast req.params.id as string to resolve TS2345 type errors --- backend/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index ac3a3b5f..e09ee973 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1358,7 +1358,7 @@ app.get('/api/nodes', async (req: Request, res: Response) => { // Get a specific node app.get('/api/nodes/:id', async (req: Request, res: Response) => { try { - const id = parseInt(req.params.id); + const id = parseInt(req.params.id as string); const node = DatabaseService.getInstance().getNode(id); if (!node) { return res.status(404).json({ error: 'Node not found' }); @@ -1406,7 +1406,7 @@ app.post('/api/nodes', async (req: Request, res: Response) => { // Update a node app.put('/api/nodes/:id', async (req: Request, res: Response) => { try { - const id = parseInt(req.params.id); + const id = parseInt(req.params.id as string); const updates = req.body; DatabaseService.getInstance().updateNode(id, updates); @@ -1424,7 +1424,7 @@ app.put('/api/nodes/:id', async (req: Request, res: Response) => { // Delete a node app.delete('/api/nodes/:id', async (req: Request, res: Response) => { try { - const id = parseInt(req.params.id); + const id = parseInt(req.params.id as string); DatabaseService.getInstance().deleteNode(id); NodeRegistry.getInstance().evictConnection(id); res.json({ success: true }); @@ -1437,7 +1437,7 @@ app.delete('/api/nodes/:id', async (req: Request, res: Response) => { // Test connection to a node app.post('/api/nodes/:id/test', async (req: Request, res: Response) => { try { - const id = parseInt(req.params.id); + const id = parseInt(req.params.id as string); const result = await NodeRegistry.getInstance().testConnection(id); res.json(result); } catch (error: any) {