@ui5/server. server


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

Start a server for the given project (sub-)tree.
Name Type Description
tree object A (sub-)tree
options object Options
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
acceptRemoteConnections boolean <optional>
false If true, listens to remote connections and not only to localhost connections
sendSAPTargetCSP boolean <optional>
false If true, then the content security policies that SAP and UI5 aim for (AKA 'target policies'), are send for any requested *.html file
simpleIndex boolean <optional>
false Use a simplified view for the server directory listing
serveCSPReports boolean <optional>
false Enable csp reports serving for request url '/.ui5/csp/csp-reports.json'
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.