Page Contents

Home > @loopback/rest > RestApplication > static

RestApplication.static() method

Mount static assets to the REST server. See https://expressjs.com/en/4x/api.html#express.static

Signature:

static(path: PathParams, rootDir: string, options?: ServeStaticOptions): void;

Parameters

Parameter Type Description
path PathParams The path(s) to serve the asset. See examples at https://expressjs.com/en/4x/api.html#path-examples To avoid performance penalty, / is not allowed for now.
rootDir string The root directory from which to serve static assets
options ServeStaticOptions (Optional) Options for serve-static

Returns:

void