Last active
January 22, 2020 15:10
-
-
Save mholtzhausen/a267c14fd0a73e1f9aa95b085d2134c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { serve } from "https://deno.land/std@v0.30.0/http/server.ts"; | |
const s = serve({ port: 8000 }); | |
console.log("http://localhost:8000/"); | |
let c=0 | |
let st=null | |
for await (const req of s) { | |
if(st===null)st=Date.now() | |
let sd=(Date.now()-st)/1000 | |
let rps=(c+1)/sd | |
req.respond({ body: `Hello World\nRequests Handled:${c++}\nSeconds:${sd}\nRPS: ${rps}` }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment