Server Config

The server config is an object that contains the following properties:

// server.ts

import { serve } from "aleph/server";

serve({
  port: 8080,
  router: {
    glob: "./routes/**/*.{ts,tsx}",
  },
  middlewares: [/* ... */],
  uncoss: {/* ... */},
  ssr: (ctx) => {
    return renderToString(<App />);
  },
});
export interface ServerConfig extends ServeInit {
  /** The cert file for tls. */
  certFile?: string;
  /** The key file for tls. */
  keyFile?: string;
  /** The error handler. */
  onError?: ErrorHandler;
  /** The base url of the server. */
  baseUrl?: string;
  /** The router options for the file-system based routing. */
  router?: RouterInit;
  /** The module loaders. */
  loaders?: ModuleLoader[];
  /** The server middlewares. */
  middlewares?: Middleware[];
  /** The options for session. */
  session?: SessionOptions;
  /** The options for SSR. */
  ssr?: SSR;
  /** The options for optimization. */
  optimization?: OptimizationOptions;
  /** The config for UnoCSS. */
  unocss?: UnoConfig;
}

TLS

WIP

Router

WIP

Server-side Rendering (SSR)

WIP

Middlewares

WIP

UnoCSS (Automatic CSS)

WIP

Module Loader

WIP

Setup Session

WIP

Optimization Options

WIP

Error Handler

WIP