summaryrefslogtreecommitdiff
path: root/std/http/testdata/simple_server.ts
blob: 05f169705a4270be7fdc0b5a916c9594894f8ffa (plain)
1
2
3
4
5
6
7
8
9
10
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// This is an example of a server that responds with an empty body
import { serve } from "../server.ts";

const port = parseInt(Deno.args[0] || "4502");
const addr: Deno.ListenOptions = { port };
console.log(`Simple server listening on ${port}`);
for await (const req of serve(addr)) {
  req.respond({});
}