Apis
Javascript api
Config

Config

#server

Defines the server-related settings for your application.

  • port
    The port your server will use.
    Type: number
    Default: 3000

  • options
    HTTP server options (from import("senta").Config).
    Type: ServerOptions

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.
Type: string
Default: Current working directory.


#middlewares

Defines an array of middleware functions for the application.
Type: Middleware[]
Learn more


#allowAutoMiddlewares

Allows automatic importing of middleware from a specified directory.
Type: boolean
Default: false
Learn more


#middlewareDirectory

Specifies the directory containing middleware files.
Type: string
Default: "middlewares"
Learn more


#loaders

Specifies custom loaders for TypeScript or JavaScript files.
Type: Loader[]


#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>


#enableReporter

Enables logging of error messages.
Type: boolean
Default: true


#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[]
Learn more


#experimental

Enables experimental features.
Type: ExperimentalFeatures

Experimental Features

  • useHTML
    Enables an enhanced HTML renderer. Requires the segify package.
    Type: boolean
    Default: false
    Learn more