Skip to main content
Module

x/sift/mod.ts>serveStatic

Sift is a routing and utility library for Deno Deploy.
Go to Latest
function serveStatic
import { serveStatic } from "https://deno.land/x/sift@0.5.0/mod.ts";

Serve static files hosted on the internet or relative to your source code.

Be default, up to 20 static assets that are less than 10MB are cached. You can disable caching by setting cache: false in the options object.

Examples

Example 1

import { serve, serveStatic } from "https://deno.land/x/sift/mod.ts"

serve({
 // It is required that the path ends with `:filename+`
 "/:filename+": serveStatic("public", { baseUrl: import.meta.url }),
})

Parameters

relativePath: string