Skip to main content
Module

x/fresh/src/server/deps.ts

The next-gen web framework.
Extremely Popular
Go to Latest
import * as fresh from "https://deno.land/x/fresh@1.1.1/src/server/deps.ts";

Enums

Standard HTTP status codes.

Functions

Pretty-prints an analysis of the metafile JSON to a string. This is just for convenience to be able to match esbuild's pretty-printing exactly. If you want to customize it, you can just inspect the data in the metafile yourself.

A synchronous version of "analyzeMetafile".

A synchronous version of "build".

Converts log messages to formatted message strings suitable for printing in the terminal. This allows you to reuse the built-in behavior of esbuild's log message formatter. This is a batch-oriented API for efficiency.

A synchronous version of "formatMessages".

This configures the browser-based version of esbuild. It is necessary to call this first and wait for the returned promise to be resolved before making other API calls when using esbuild in the browser.

This function is similar to "build" but it serves the resulting files over HTTP on a localhost address with the specified port.

This function transforms a single JavaScript file. It can be used to minify JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript to older JavaScript. It returns a promise that is either resolved with a "TransformResult" object or rejected with a "TransformFailure" object.

A synchronous version of "transform".

Builds an InternalRoutes array from a Routes record.

The default error handler for the router. By default it responds with null body and a status of 500 along with console.error logging the caught error.

The default other handler for the router. By default it responds with null body and a status of 404.

The default unknown method handler for the router. By default it responds with null body, a status of 405 and the Accept header set to all METHODS | known methods.

A simple and tiny router for deno

Serves HTTP requests with the given handler.

Returns the media type associated with the file extension. Values are normalized to lower case and matched irrespective of a leading ..

Walks the file tree rooted at root, yielding each file or directory in the tree filtered according to the given options. The files are walked in lexical order, which makes the output deterministic but means that for very large directories walk() can be inefficient.

Interfaces

Information about the connection a request arrived on.

Additional serve options.

Type Aliases

A handler for HTTP requests. Consumes a request and connection information and returns a response.

A handler type for anytime the MatchHandler or other parameter handler fails

A handler for HTTP requests. Consumes a request and HandlerContext and returns an optionally async response.

Provides arbitrary context to Handler functions along with connection information.

The internal route object contains either a RegExp pattern or URLPattern which is matched against the incoming request URL. If a match is found for both the pattern and method the associated MatchHandler is called.

An array of InternalRoute | internal route objects which the Routes | routes record is mapped into. This array is used internally in the router function and can even be passed directly to it if you do not wish to use the Routes | routes record or want more fine grained control over matches, for example by using a RegExp pattern instead of a URLPattern.

A handler type for a router path match which gets passed the matched values

A record of route paths and MatchHandlers which are called when a match is found along with it's values.

A handler type for anytime a method is received that is not defined