Skip to main content
Module

x/netzo/mod.ts>serve

SDK for Netzo, the open platform to instantly deploy JavaScript and TypeScript to URL endpoints, connect essential APIs, automate business processes and build internal tools faster, without managing servers.
Go to Latest
function serve
import { serve } from "https://deno.land/x/netzo@v0.1.44/mod.ts";

serve() registers "fetch" event listener and invokes the provided route handler for the route with the request as first argument and processed path params as the second.

Examples

Example 1

serve({
 "/": (request: Request) => new Response("Hello World!"),
 404: (request: Request) => new Response("not found")
})

The route handler declared for 404 will be used to serve all requests that do not have a route handler declared.

Parameters

userRoutes: Routes
optional
options: ServeInit = [UNSUPPORTED]