Apis
Javascript api
Config

Config

#server

Defines the server-related settings for your application.

#server.port

The port your server will use.

Typenumber
Default3000

#server.options

HTTP server options (from import("senta").Config).

Typeimport("senta").Config
Default
Typescript
import { createServer } from 'http';
export interface Config {
  server?: {
    port?: number;
  };
  createServer?: typeof createServer;
  fetch?: typeof fetch;
}

#cwd

Specifies the base directory for your application.

Typestring
Defaultprocess.cwd()

#middlewares

Defines an array of middleware functions for the application.

TypeMiddleware[]
Default[]

Learn more

#allowAutoMiddlewares

Allows automatic importing of middleware from a specified directory.

Typeboolean
Defaultfalse

Learn more

#middlewareDirectory

Specifies the directory containing middleware files.

Typestring
Default./middlewares/

Learn more

#loaders

Specifies custom loaders for TypeScript or JavaScript files.

TypeLoader[]
Default[]

Unless otherwise specified, zely automatically uses the esbuild or serpack loader.

#plugins

Defines an array of plugins for the application.

TypePlugin[]
Default[]

#dist

Defines the output directory for build artifacts.

Typestring
Default./.zely/

#globalImport

Enables automatic importing of methods like GET, POST, etc.

Typeboolean
Defaultfalse

#onError

A callback function to handle errors.

Type(err: Error) => void | Promise<void>
Defaultnull

#keepDist

Keeps the .zely directory for debugging purposes, including source maps for error reporting.

Typeboolean
Defaultfalse

#__virtuals__

Defines virtual pages for dynamic routing.

Typeany[]
Default[]

Learn more


#experimental

Enables experimental features.

#experimental.useHTML

Enables an enhanced HTML renderer. Requires the segify package.

Typeboolean
Defaultfalse

Learn more

#experimental.useSerpack

Enables an serpack loader instead of esbuild.

Typeboolean
Defaultfalse

Learn more