Complete the code to import a module in Deno.
import { serve } from "https://deno.land/std/http/server.ts"; const server = serve({ port: [1] });
In Deno, you import modules directly from URLs. The port 8080 is commonly used for local servers.
Complete the code to read a file asynchronously in Deno.
const data = await Deno.[1]("./file.txt");
Deno provides readTextFile to read text files asynchronously and return a string.
Fix the error in the Deno permission request code.
const status = await Deno.permissions.[1]({ name: "read" });
To ask the user for permission in Deno, use the request method.
Fill both blanks to create a simple HTTP server in Deno that responds with 'Hello World'.
import { serve } from "https://deno.land/std/http/server.ts"; for await (const req of serve({ port: [1] })) { req.[2](new Response("Hello World")); }
The server listens on port 8080 and uses the respond method to send the response.
Fill all three blanks to create a Deno script that imports a local module and logs its default export.
import myFunc from "./mod.ts"; const result = myFunc([1]); console.[2](result); // Run with: deno run --allow-[3] script.ts
The function is called with a string argument, the result is logged with console.log, and the script needs read permission to import local files.
