mirror of
https://github.com/rjNemo/deno_hello
synced 2026-06-12 12:56:38 +00:00
basic server
This commit is contained in:
parent
7f0e54b29d
commit
78d7597c76
2 changed files with 9 additions and 0 deletions
3
Makefile
3
Makefile
|
|
@ -1,5 +1,8 @@
|
||||||
.PHONY: cli
|
.PHONY: cli
|
||||||
cli:
|
cli:
|
||||||
deno run cli.ts
|
deno run cli.ts
|
||||||
|
.PHONY: run
|
||||||
|
run:
|
||||||
|
deno run --allow-net server.ts
|
||||||
tests:
|
tests:
|
||||||
deno test --coverage --unstable
|
deno test --coverage --unstable
|
||||||
6
server.ts
Normal file
6
server.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { listenAndServe } from "https://deno.land/std@0.87.0/http/server.ts";
|
||||||
|
|
||||||
|
const port = 8000;
|
||||||
|
|
||||||
|
console.log(`Server listening on http://localhost:${port}/`);
|
||||||
|
await listenAndServe({ port }, (req) => req.respond({ body: "Hello" }));
|
||||||
Loading…
Reference in a new issue