import { Router } from 'worktop'; import * as Cache from 'worktop/cache'; import { uid as toUID } from 'worktop/utils'; import { read, write } from 'worktop/kv'; import type { KV } from 'worktop/kv'; declare var DATA: KV.Namespace; interface Message { id: string; text: string; // ... } // Initialize const API = new Router(); API.add('GET', '/messages/:id', async (req, res) => { // Pre-parsed `req.