Skip to main content
Module

x/cav/http.ts>ServeAssetOptions

A server framework for Deno
Go to Latest
interface ServeAssetOptions
import { type ServeAssetOptions } from "https://deno.land/x/cav@0.0.14/http.ts";

Options controlling how assets are found and served.

Properties

optional
cwd: string

Sets the current working directory when looking for assets. If a file:// path is provided, the parent folder of the path is used. This is useful if you want to serve assets relative to the current file using import.meta.url. Default: "."

optional
dir: string

The directory to serve assets from inside the cwd. This pattern encourages keeping public asset files separated from application source code, so that code isn't served by mistake. To use the cwd alone, specify ".". Default: "assets"

path: string

Path of the file to serve relative to the dir (which is relative to the cwd). The full path of the served file on disk is path.join(cwd, dir, path). This option is required.

optional
path404: string

Path to use when the provided path results in a 404 error. Use this to serve a 404 page. If this isn't specified, 404 errors will bubble. Default: undefined