1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00
denoland-deno/net
2019-01-11 00:16:47 -05:00
..
bufio.ts Add format script. 2018-12-18 18:56:59 -05:00
bufio_test.ts Fix format globs (denoland/deno_std#87) 2019-01-06 14:19:15 -05:00
file_server.ts Add media_types collection (denoland/deno_std#97) 2019-01-11 00:16:47 -05:00
file_server_test.ts Add media_types collection (denoland/deno_std#97) 2019-01-11 00:16:47 -05:00
http.ts Make compatible with latest deno (denoland/deno_std#41) 2018-12-23 18:49:46 -05: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 Fix format globs (denoland/deno_std#87) 2019-01-06 14:19:15 -05:00
iotest.ts Rename project to deno_std 2018-12-18 18:27:05 -05:00
ioutil.ts Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -05:00
ioutil_test.ts Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -05:00
README.md Add colors module (denoland/deno_std#30) 2018-12-18 23:30:44 -05:00
sha1.ts Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -05:00
sha1_test.ts Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -05:00
textproto.ts Avoid textproto crashing on empty reader (denoland/deno_std#50) 2018-12-31 09:00:28 +00:00
textproto_test.ts Fix format globs (denoland/deno_std#87) 2019-01-06 14:19:15 -05:00
util.ts Rename project to deno_std 2018-12-18 18:27:05 -05:00
ws.ts Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -05:00
ws_test.ts Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -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"