Skip to content

Instantly share code, notes, and snippets.

@mayankchoubey
Last active March 6, 2021 06:43
Show Gist options
  • Save mayankchoubey/df7335be0df5a378bfb17d49e2ac9508 to your computer and use it in GitHub Desktop.
Save mayankchoubey/df7335be0df5a378bfb17d49e2ac9508 to your computer and use it in GitHub Desktop.
import { serve } from "https://deno.land/std/http/server.ts";
const text = await Deno.readTextFile("/var/tmp/sample.json");
const json = JSON.parse(text);
const s = serve({ port: 3000 });
for await (const req of s) {
req.respond({ status: 200,
body: JSON.stringify(json) });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment