mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
2f8825a935
By default, `deno serve` will assign port 8000 (like `Deno.serve`). Users may choose a different port using `--port`. `deno serve /tmp/file.ts` `server.ts`: ```ts export default { fetch(req) { return new Response("hello world!\n"); }, }; ```
18 lines
319 B
TypeScript
18 lines
319 B
TypeScript
(async () => {
|
|
for (let i = 0; i < 1000; i++) {
|
|
try {
|
|
const resp = await fetch("http://localhost:12345/");
|
|
Deno.exit(0);
|
|
} catch {
|
|
await new Promise((r) => setTimeout(r, 10));
|
|
}
|
|
}
|
|
|
|
Deno.exit(2);
|
|
})();
|
|
|
|
export default {
|
|
fetch(req) {
|
|
return new Response("Hello world!");
|
|
},
|
|
};
|