Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MoxyServer

Hierarchy

  • MoxyServer

Index

Constructors

Properties

router: Router

The internal router

server?: Server

Instance of HTTP server

Accessors

  • get logLevel(): string
  • set logLevel(value: string): void
  • get port(): number

Methods

  • addRoutesFromFolder(path: string): Promise<MoxyServer>
  • Recursively search the folder at for files matching .routes.js(on) and import their config

    Parameters

    • path: string

    Returns Promise<MoxyServer>

  • getFolderContents(dirPath: string): Promise<Dirent[]>
  • Gets the folder contents

    Parameters

    • dirPath: string

      The dir path

    Returns Promise<Dirent[]>

    {Promise<fsDirent[]>

  • listen(port?: number): Promise<Server>
  • loadConfigFromFile(filePath: string, basePath: string): void
  • Loads a configuration from file

    Parameters

    • filePath: string

      The file path

    • basePath: string

      The base path

    Returns void

  • Same as calling @MoxyServer.on over Object.entries with a prefx

    Parameters

    • prefix: string

      The path prefix to prepend to all routes

    • routes: Routes

      Path suffix keyed RouteConfig

    • Optional options: AddRouteOptions

      Extra router options

    Returns MoxyServer

Generated using TypeDoc