alepha@docs:~/framework/docs/reference/primitives$
cat $serve.md | pretty2 min read
#$serve
#Import
typescript
1import { $serve } from "alepha/server/static";
#Overview
Create a new static file handler.
#Options
| Option | Type | Required | Description |
|---|---|---|---|
path |
string |
No | Prefix for the served path. |
root |
string |
No | Path to the directory to serve. |
disabled |
boolean |
No | If true, primitive will be ignored: none of its files is mounted. |
ignoreDotEnvFiles |
boolean |
No | Whether to exclude dot files (e.g |
indexFallback |
boolean |
No | Whether to use the index.html file when the path is a directory. |
historyApiFallback |
boolean |
No | Force all requests "not found" to be served with the index.html file |
site |
boolean |
No | Serve the directory the way Cloudflare and Bay serve a static site with no server behind it, for a build with runtime: ["static"]: - /about answers from about.html (the prerender writes pages flat), then from about/index.html; - any other path without an extension answers 200.html with status 200, the SPA shell; - anything else that matches no file answers 404.html with status 404 |
name |
string |
No | Optional name of the primitive |
cacheControl |
Partial<CacheControlOptions> | false |
No | Cache-control configuration |
headersFile |
boolean |
No | Apply the _headers file at the root of the served files to every response of this server, the way Cloudflare and Bay apply it to the files they serve |
silent |
boolean |
No | Whether to suppress logging for this primitive. |