import { parse } from "https://deno.land/x/std@0.177.0/node/url.ts"; const url = "https://example.com/path?name=deno&lang=js"; const parsed = parse(url); console.log(parsed.query);
The parse function from the Node.js URL module returns an object where the query property is a string containing the query part of the URL, not an object.
So, parsed.query is the string name=deno&lang=js.
The Deno standard library is imported from https://deno.land/std@version/. The correct path for the HTTP server module is http/server.ts.
Option A uses the correct URL and syntax.
import { someFunction } from "https://deno.land/x/somemodule@v1.0.0/mod.ts"; someFunction();
Deno expects version tags without the 'v' prefix in deno.land/x URLs. Using 'v1.0.0' instead of '1.0.0' causes a 404 error.
import { delay } from "https://deno.land/x/std@0.177.0/async/delay.ts"; async function run() { console.log("Start"); await delay(100); console.log("End"); } run();
The delay function returns a promise that resolves after the given time. Using await pauses the function until the delay finishes.
So, "Start" is printed first, then after 100ms, "End" is printed.
Deno uses the full URL including version to cache modules. If you change the version in the URL, Deno treats it as a different module and fetches it anew.
