or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

application-builders.mddevelopment-server.mdindex.mdlibrary-packaging.mdserver-side-rendering.mdtesting-builders.mdtesting-utilities.md
tile.json

development-server.mddocs/

Development Server

Development server with live reloading, hot module replacement, and proxy support for Angular applications during development.

Capabilities

Dev Server Builder

Serves Angular applications with development features like live reload and hot module replacement.

/**
 * Execute development server for Angular applications
 * @param options - Development server configuration
 * @param context - Angular Architect builder context
 * @returns Observable with server status and URL information
 */
function executeDevServerBuilder(
  options: DevServerBuilderOptions,
  context: BuilderContext
): Observable<DevServerBuilderOutput>;

interface DevServerBuilderOptions {
  /** Build target to serve (e.g., "my-app:build") */
  buildTarget: string;
  /** Port number for the server */
  port?: number;
  /** Host address to bind to */
  host?: string;
  /** Path to proxy configuration file */
  proxyConfig?: string;
  /** Enable HTTPS */
  ssl?: boolean;
  /** Path to SSL private key */
  sslKey?: string;
  /** Path to SSL certificate */
  sslCert?: string;
  /** Open browser automatically */
  open?: boolean;
  /** Enable live reload */
  liveReload?: boolean;
  /** Public host for client connections */
  publicHost?: string;
  /** Disable host check warnings */
  disableHostCheck?: boolean;
  /** Path to serve the app from */
  servePath?: string;
  /** Custom HTTP headers */
  headers?: Record<string, string>;
  /** Enable Hot Module Replacement */
  hmr?: boolean;
  /** Watch files for changes */
  watch?: boolean;
  /** Poll for file changes (milliseconds) */
  poll?: number;
  /** Allowed hosts for dev server */
  allowedHosts?: string[];
  /** Enable verbose logging */
  verbose?: boolean;
}

interface DevServerBuilderOutput extends BuilderOutput {
  /** Server base URL */
  baseUrl?: string;
  /** Local network URLs */
  localUrls?: string[];
  /** External network URLs */  
  externalUrls?: string[];
}

Usage Examples:

import { executeDevServerBuilder } from "@angular-devkit/build-angular";
import { BuilderContext } from "@angular-devkit/architect";

// Basic development server
const devOptions: DevServerBuilderOptions = {
  buildTarget: "my-app:build",
  port: 4200,
  host: "localhost",
  open: true,
  liveReload: true
};

// Development server with SSL and proxy
const sslDevOptions: DevServerBuilderOptions = {
  buildTarget: "my-app:build",
  port: 4200,
  host: "0.0.0.0",
  ssl: true,
  sslKey: "ssl/private-key.pem",
  sslCert: "ssl/certificate.pem",
  proxyConfig: "proxy.conf.json",
  headers: {
    "Access-Control-Allow-Origin": "*"
  }
};

// Start development server
const serverResult = await executeDevServerBuilder(devOptions, context).toPromise();
console.log(`Server running at: ${serverResult.baseUrl}`);

SSR Development Server

Development server for Angular Universal applications with server-side rendering.

/**
 * Execute SSR development server for universal applications
 * @param options - SSR dev server configuration
 * @param context - Builder context
 * @returns Observable with server information
 */  
function executeSSRDevServerBuilder(
  options: SSRDevServerBuilderOptions,
  context: BuilderContext
): Observable<SSRDevServerBuilderOutput>;

interface SSRDevServerBuilderOptions {
  /** Browser target for client-side build */
  browserTarget: string;
  /** Server target for SSR build */  
  serverTarget: string;
  /** Port number */
  port?: number;
  /** Host address */
  host?: string;
  /** Proxy configuration */
  proxyConfig?: string;
  /** Enable HTTPS */
  ssl?: boolean;
  /** SSL private key path */
  sslKey?: string;
  /** SSL certificate path */
  sslCert?: string;
  /** Open browser */
  open?: boolean;
  /** Public host for external access */
  publicHost?: string;
  /** Serve path */
  servePath?: string;
  /** Disable host checking */
  disableHostCheck?: boolean;
  /** Enable Hot Module Replacement */
  hmr?: boolean;
  /** Live reload */
  liveReload?: boolean;
  /** Custom headers */
  headers?: Record<string, string>;
}

interface SSRDevServerBuilderOutput extends BuilderOutput {
  /** Server base URL */
  baseUrl?: string;
  /** Additional server information */
  info?: {
    https: boolean;
    port: number;
    host: string;
  };
}

Proxy Configuration

/**
 * Proxy configuration for API calls during development
 */
interface ProxyConfig {
  [path: string]: {
    /** Target server URL */
    target: string;
    /** Enable secure connections */
    secure?: boolean;
    /** Change the origin header */
    changeOrigin?: boolean;
    /** Log proxy requests */
    logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
    /** Custom headers for proxied requests */
    headers?: Record<string, string>;
    /** Path rewriting rules */
    pathRewrite?: Record<string, string>;
    /** Bypass proxy for certain requests */
    bypass?: (req: any, res: any, proxyOptions: any) => string | null | undefined;
  };
}

Proxy Configuration Example:

{
  "/api/*": {
    "target": "http://localhost:3000",
    "secure": false,
    "changeOrigin": true,
    "logLevel": "debug"
  },
  "/assets/*": {
    "target": "http://localhost:3000",
    "secure": false,
    "pathRewrite": {
      "^/assets": "/static"
    }
  }
}

Server Configuration

interface ServerConfiguration {
  /** Server port */
  port: number;
  /** Server host */
  host: string;
  /** SSL configuration */
  https?: {
    key: string;
    cert: string;
    ca?: string;
  };
  /** Compression settings */
  compression?: boolean;
  /** Static file serving */
  static?: {
    /** Serve path */
    directory: string;
    /** Enable directory listing */
    serveIndex: boolean;
    /** Watch files */
    watch: boolean;
  };
}