refactor: replace references of options with config (#1903)

This commit is contained in:
Asher Gomez
2023-10-11 09:25:03 +02:00
committed by GitHub
parent 1d12853889
commit 6ddef91d95
28 changed files with 138 additions and 127 deletions
+5 -11
View File
@@ -8,22 +8,16 @@ In this page we discuss how the server can be configured during startup.
The signature of the primary method looks like this:
```ts main.ts
export async function start(manifest: Manifest, opts: StartOptions = {});
export async function start(manifest: Manifest, config: FreshConfig = {});
```
## Options
## Configuration
`Manifest` comes from `fresh.gen.ts`, so nothing to do there. `opts` is where
things get interesting. `StartOptions` looks like this:
```
export type StartOptions = ServeInit & FreshOptions;
```
The good stuff is really in...
`Manifest` comes from `fresh.gen.ts`, so nothing to do there. `config` is where
things get interesting. `FreshConfig` looks like this:
```ts
export interface FreshOptions {
export interface FreshConfig {
render?: RenderFunction;
plugins?: Plugin[];
staticDir?: string;
@@ -35,7 +35,7 @@ passing the extra folder as an argument: `--watch=static/`. You should also add
`routes/` to the watch list, so that the server restarts automatically whenever
you add a new route.
If you want to change the port or host, modify the options bag of the `start()`
If you want to change the port or host, modify the config bag of the `start()`
call in `main.ts` to include an explicit port number:
```js main.ts