StaticFileOpts: { apiPrefixes?: string[]; defaultCode?: number; defaultFile?: string; fileRoot?: string; urlRoot?: string }

With StaticFileOpts, you can set up things such that

  1. If a request comes in prefixed by urlRoot, oa request comes in NOT prefixed by apiPrefixes
  2. the static file at fileRoot/ will be served
  3. If there is no such file there, fileRoot/defaultFile will be served with HTTP CODE defaultCode

It is not a particularly efficient file server, but it should do the job in a pinch

Type declaration

  • Optional apiPrefixes?: string[]

    prefixes that should be served by the object returned from createApiServer instead of a static file server

  • Optional defaultCode?: number

    HTTP Status Code to respond with when no file found

    Default Value

    404 (Not Found)

  • Optional defaultFile?: string

    File to serve if no static file exists at the expected path, specified as relative to the file root

    Default Value

    "404.html"

  • Optional fileRoot?: string

    Root from which to look for static files

    Default Value

    "./static/"

  • Optional urlRoot?: string

    Root of requests that will result in static files being served

    Default Value

    ""

Generated using TypeDoc