Docs
Guide
Config File
Config File
By default, Dobs looks for a configuration file in the working directory.
dobs.config.tsdobs.config.mtsdobs.config.ctsdobs.config.jsdobs.config.mjsdobs.config.cjsdobs.config.json
You can specify a custom configuration file using the --config flag in the CLI, but it’s recommended not to rely on this option.
#Creating a Config File
You can customize the Dobs server using a configuration file.
Typescript
import { defineConfig } from "dobs";
export default defineConfig({});INFO
The defineConfig() function exists only for type safety and can also be used
in JavaScript.
#Config Interface
Typescript
export interface ResolvedServerConfig {
/** port to serve (default: 8080) */
port: number;
/** middlewares */
middlewares: Middleware[];
/** base server */
createServer: typeof createServer;
/** cwd */
cwd: string;
/**
* + `serve` : return server instance (default)
* + `middleware` : return dobs middleware
*/
mode: "serve" | "middleware";
/**
* temp path (relative, default: `./.dobs/`)
*/
temp: string;
build: {
/**
* build output directory (relative)
*/
directory: string;
};
plugins: Plugin[];
devtool: boolean;
}