Skip to main content
Module

x/license_checker/dev_deps.ts>serve

📄 CLI tool for checking license headers in files
Go to Latest
function serve
import { serve } from "https://deno.land/x/license_checker@v3.2.0/dev_deps.ts";

Serves HTTP requests with the given handler.

You can specify an object with a port and hostname option, which is the address to listen on. The default is port 8000 on hostname "0.0.0.0".

The below example serves with the port 8000.

import { serve } from "https://deno.land/std@0.224.0/http/server.ts";
serve((_req) => new Response("Hello, world"));

You can change the listening address by the host and port option. The below example serves with the port 3000.

import { serve } from "https://deno.land/std@0.224.0/http/server.ts";
serve((_req) => new Response("Hello, world"), { port: 3000 });
console.log("Listening on http://localhost:3000");

Parameters

handler: Handler

The handler for individual HTTP requests.

optional
options: ServeInit = [UNSUPPORTED]

The options. See ServeInit documentation for details.

Returns

Promise<void>