I am new to deno and created a simple code that response to my request. I put a counter over there to see how many times the response is repeating and I get it twice every time.
What is wrong with my code that makes server response twice for each request ?
import { serve } from "https://deno.land/std@0.53.0/http/server.ts";
const s = serve({ port: 8891 });
var counter=0;
console.log("http://localhost:8891/");
for await (const req of s) {
req.respond({ body: "<h1>" + counter + "</h1>" });
counter ++;
}
Response for counter on web browser : 2,4,6,...