std/net
Dmitry Sharshakov aka. sh7dm c9d6028be8 Add more MIME types (#56)
2018-12-31 09:38:32 +00:00
..
bufio_test.ts migrate deno_path to deno_std (#26) 2018-12-18 21:29:39 -05:00
bufio.ts Add format script. 2018-12-18 18:56:59 -05:00
extension_map.json Add more MIME types (#56) 2018-12-31 09:38:32 +00:00
file_server_test.ts Add content-type header to file_server (#47) 2018-12-31 09:06:05 +00:00
file_server.ts Add content-type header to file_server (#47) 2018-12-31 09:06:05 +00:00
http_bench.ts Rename project to deno_std 2018-12-18 18:27:05 -05:00
http_status.ts Rename project to deno_std 2018-12-18 18:27:05 -05:00
http_test.ts Make compatible with latest deno (#41) 2018-12-23 18:49:46 -05:00
http.ts Make compatible with latest deno (#41) 2018-12-23 18:49:46 -05:00
iotest.ts Rename project to deno_std 2018-12-18 18:27:05 -05:00
README.md Add colors module (#30) 2018-12-18 23:30:44 -05:00
textproto_test.ts Avoid textproto crashing on empty reader (#50) 2018-12-31 09:00:28 +00:00
textproto.ts Avoid textproto crashing on empty reader (#50) 2018-12-31 09:00:28 +00:00
util.ts Rename project to deno_std 2018-12-18 18:27:05 -05:00

net

Usage:

import { serve } from "https://deno.land/x/net/http.ts";
const s = serve("0.0.0.0:8000");

async function main() {
  for await (const req of s) {
    req.respond({ body: new TextEncoder().encode("Hello World\n") });
  }
}

main();

File Server

A small program for serving local files over HTTP.

Add the following to your .bash_profile

alias file_server="deno https://deno.land/x/net/file_server.ts --allow-net"