Config
#server
Defines the server-related settings for your application.
#server.port
The port your server will use.
Type | number |
---|---|
Default | 3000 |
#server.options
HTTP server options (from import("senta").Config
).
Type | import("senta").Config |
---|---|
Default |
import { createServer } from 'http';
export interface Config {
server?: {
port?: number;
};
createServer?: typeof createServer;
fetch?: typeof fetch;
}
#cwd
Specifies the base directory for your application.
Type | string |
---|---|
Default | process.cwd() |
#middlewares
Defines an array of middleware functions for the application.
Type | Middleware[] |
---|---|
Default | [] |
#allowAutoMiddlewares
Allows automatic importing of middleware from a specified directory.
Type | boolean |
---|---|
Default | false |
#middlewareDirectory
Specifies the directory containing middleware files.
Type | string |
---|---|
Default | ./middlewares/ |
#loaders
Specifies custom loaders for TypeScript or JavaScript files.
Type | Loader[] |
---|---|
Default | [] |
Unless otherwise specified, zely automatically uses the esbuild or serpack loader.
#plugins
Defines an array of plugins for the application.
Type | Plugin[] |
---|---|
Default | [] |
#dist
Defines the output directory for build artifacts.
Type | string |
---|---|
Default | ./.zely/ |
#globalImport
Enables automatic importing of methods like GET
, POST
, etc.
Type | boolean |
---|---|
Default | false |
#onError
A callback function to handle errors.
Type | (err: Error) => void | Promise<void> |
---|---|
Default | null |
#keepDist
Keeps the .zely
directory for debugging purposes, including source maps for error reporting.
Type | boolean |
---|---|
Default | false |
#__virtuals__
Defines virtual pages for dynamic routing.
Type | any[] |
---|---|
Default | [] |
#experimental
Enables experimental features.
#experimental.useHTML
Enables an enhanced HTML renderer. Requires the segify
package.
Type | boolean |
---|---|
Default | false |
#experimental.useSerpack
Enables an serpack loader instead of esbuild.
Type | boolean |
---|---|
Default | false |