Function universal

  • Runs SGRUD in universal (SSR) mode using puppeteer.

    Description
      Runs SGRUD in universal (SSR) mode using `puppeteer`
    
    Usage
      $ sgrud universal [entry] [options]
    
    Options
      --chrome      Chrome executable path  (default /usr/bin/chromium-browser)
      --prefix      Use an alternative working directory  (default ./)
      -H, --host    Host/IP to bind to  (default 127.0.0.1)
      -p, --port    Port to bind to  (default 4000)
      -h, --help    Displays this message
    
    Examples
      $ sgrud universal # Run with default options
      $ sgrud universal --host 0.0.0.0 # Listen on all IPs
      $ sgrud universal -H 192.168.0.10 -p 4040 # Listen on 192.168.0.10:4040
    

    Parameters

    • options: {
          chrome?: string;
          entry?: string;
          host?: string;
          port?: string;
          prefix?: string;
      } = {}

      The options object.

      • Optional chrome?: string

        Chrome executable path.

        Default Value

        '/usr/bin/chromium-browser'

      • Optional entry?: string

        HTML document (relative to prefix).

        Default Value

        'index.html'

      • Optional host?: string

        Host/IP to bind to.

        Default Value

        '127.0.0.1'

      • Optional port?: string

        Port to bind to.

        Default Value

        '4000'

      • Optional prefix?: string

        Use an alternative working directory.

        Default Value

        './'

    Returns Promise<void>

    An execution Promise.

    Example

    Run with default options:

    require('@sgrud/bin');

    sgrud.bin.universal();

    Example

    Listen on all IPs:

    require('@sgrud/bin');

    sgrud.bin.universal({
    host: '0.0.0.0'
    });

    Example

    Listen on 192.168.0.10:4040:

    require('@sgrud/bin');

    sgrud.bin.universal({
    host: '192.168.0.10',
    port: '4040'
    });

Generated using TypeDoc