server

@ui5/server. server

Methods

(static) serve(tree, options) → {Promise.<object>}

Source:
Start a server for the given project (sub-)tree.
Parameters:
Name Type Description
tree object A (sub-)tree
options object Options
Properties
Name Type Attributes Default Description
port number Port to listen to
changePortIfInUse boolean <optional>
false If true, change the port if it is already in use
h2 boolean <optional>
false Whether HTTP/2 should be used - defaults to http
key string <optional>
Path to private key to be used for https
cert string <optional>
Path to certificate to be used for for https
simpleIndex boolean <optional>
false Use a simplified view for the server directory listing
acceptRemoteConnections boolean <optional>
false If true, listens to remote connections and not only to localhost connections
sendSAPTargetCSP boolean | module:@ui5/server.server.SAPTargetCSPOptions <optional>
false If set to true or an object, then the default (or configured) set of security policies that SAP and UI5 aim for (AKA 'target policies'), are send for any requested *.html file
serveCSPReports boolean <optional>
false Enable CSP reports serving for request url '/.ui5/csp/csp-reports.json'
Returns:
Promise resolving once the server is listening. It resolves with an object containing the port, h2-flag and a close function, which can be used to stop the server.
Type
Promise.<object>

Type Definitions

SAPTargetCSPOptions

Source:
Properties:
Name Type Attributes Default Description
defaultPolicy string <optional>
"sap-target-level-1"
defaultPolicyIsReportOnly string <optional>
true
defaultPolicy2 string <optional>
"sap-target-level-2"
defaultPolicy2IsReportOnly string <optional>
true
ignorePaths Array.<string> <optional>
["test-resources/sap/ui/qunit/testrunner.html"]
SAP target CSP middleware options
Type:
  • object