I have been playing with Deno Oak. Looked at some of the basic routing examples and none of them are using 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 above example, request and response is of any
type. I tried to replace it with following types which are not compatible for body?
import { ServerRequest, ServerResponse } from "http://deno.land/x/oak/mod.ts";
I'll appreciate if someone can point me to a relevant example or shed some light on this.