HTML
CSS
Deno
Examples
Do It Yourself
Code
Input
Run
//Import the server module import { serve } from "https://deno.land/std/http/server.ts"; // serve on port 5000 const s = serve({ port: 5000 }); console.log('Listening to port 5000 on http://localhost:5000'); // Wait for request and response with a text for await (const req of s) { // Read the index.html file and serve it const html_file = await Deno.readFile('./index.html'); // create an decoder which decodes your html file to strings before sending const decoder = new TextDecoder() req.respond({ body: decoder.decode(html_file) }); }
Related Chapters
Deno HTTP
Deno Web Server
Related Examples
Deno HTTP Request Text Example
Deno HTTP Request Example