/** * Fetch a paste by ID. * @route /api/v1/fetch/:id * @param id The paste ID. */ router.get("/fetch/:id", async (req: Request, res: Response) => { const id: string = req.params.id; try { const data: any = await DatabaseUtil.fetchPasteById(id); return res.status(200).json( { message: "Success.", paste: { title: data.title, id: data.id, content: data.content, codeblock: data.codeblock } } ); } catch (err: any) { return res.status(500).json( { message: "An error occurred while processing your request." } ); } });