Options
All
  • Public
  • Public/Protected
  • All
Menu

Module responsible to merge AddonInterface's default router with custom/extended router

Hierarchy

  • HttpServer

Index

Constructors

constructor

Properties

addonInterface

addonInterface: AddonInterface

app

app: Express

opts

opts: { cache?: number; cacheMaxAge?: number; getRouter?: (o: AddonInterface) => any; port?: number; static?: string }

Type declaration

  • Optional cache?: number
  • Optional cacheMaxAge?: number

    (in seconds) cacheMaxAge means the Cache-Control header being set to max-age=$cacheMaxAge

  • Optional getRouter?: (o: AddonInterface) => any

    Custom router param. If undefined stremio's default router is used

  • Optional port?: number
  • Optional static?: string

    Static directory to serve.

Methods

Private createCachedServer

  • createCachedServer(): Express
  • Factory method to Express.js app with preconfigured cache headers.

    Returns Express

    an Express.js app

Private getRouter

  • getRouter(): any
  • Extract the custom router from the optional parameters or retrieve the default router.

    Returns any

serve

  • serve(): Promise<{ server: Server; url: string }>
  • Serve all contents and start server

    Returns Promise<{ server: Server; url: string }>

    general informations about the running server

Private serveAPI

  • serveAPI(): void

Private serveLandingPage

  • serveLandingPage(): void
  • Add the landing page (front-end of the addon website) into the express.js app.

    Returns void

Private serveStatic

  • serveStatic(): void
  • Add the optional static content to be served by the express.js app.

    Returns void

Private start

  • start(): Promise<{ server: Server; url: string }>
  • Start the express.js app.

    Returns Promise<{ server: Server; url: string }>

    general information about the running server

Generated using TypeDoc