Recently, I've been experimenting with Deno Oak. After reviewing some basic routing examples, I noticed that none of them utilize types for request or response.
router
.post("/api/v1/products", addProduct)
const addProduct = async (
{ request, response }: {
request: any;
response: any;
},
) => {
const body = await request.body();
if (!body.value) {
response.status = 404;
response.body = {
success: false,
msg: "No data",
};
}
In the above example, both the request and response are declared as being of type any
. I attempted to substitute them with the following types that unfortunately proved incompatible with the body:
import { ServerRequest, ServerResponse } from "http://deno.land/x/oak/mod.ts";
If anyone can guide me towards a relevant example or provide further information on this topic, I would greatly appreciate it.