Created
November 12, 2020 01:21
-
-
Save mayankchoubey/1379c11a2c319c2e5478e086e3e5c7a1 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/http/server.ts"; | |
const s = serve({ port: 3000 }); | |
for await (const req of s) { | |
req.respond({ body: JSON.stringify({body: "Hello World" })}); | |
} |
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
const http = require('http'); | |
var server = http.createServer(function(request, response) { | |
response.writeHead(200, {"Content-Type": "application/json"}); | |
response.end(JSON.stringify({body: "Hello world"})); | |
}); | |
server.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment