Skip to content

Instantly share code, notes, and snippets.

@mayankchoubey
Created November 12, 2020 01:21
Show Gist options
  • Save mayankchoubey/1379c11a2c319c2e5478e086e3e5c7a1 to your computer and use it in GitHub Desktop.
Save mayankchoubey/1379c11a2c319c2e5478e086e3e5c7a1 to your computer and use it in GitHub Desktop.
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" })});
}
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