Skip to content

@ui5/server

Methods

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

Description: Start a server for the given project (sub-)tree.

Source: server/lib/server.js, line 135

Parameters:
NameTypeDescription
graph@ui5/project/graph/ProjectGraphProject graph
optionsobjectOptions
Properties:
NameTypeAttributesDefaultDescription
portnumberPort to listen to
changePortIfInUsebooleanoptionalfalseIf true, change the port if it is already in use
h2booleanoptionalfalseWhether HTTP/2 should be used - defaults to http
keystringoptionalPath to private key to be used for https
certstringoptionalPath to certificate to be used for for https
simpleIndexbooleanoptionalfalseUse a simplified view for the server directory listing
acceptRemoteConnectionsbooleanoptionalfalseIf true, listens to remote connections and
not only to localhost connections
sendSAPTargetCSPboolean | module:@ui5/server.SAPTargetCSPOptionsoptionalfalseIf 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
serveCSPReportsbooleanoptionalfalseEnable 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

Description: SAP target CSP middleware options

Source: server/lib/server.js, line 97

Properties:
NameTypeAttributesDefaultDescription
defaultPolicystringoptional"sap-target-level-1"
defaultPolicyIsReportOnlystringoptionaltrue
defaultPolicy2stringoptional"sap-target-level-3"
defaultPolicy2IsReportOnlystringoptionaltrue
ignorePathsArray<string>optional["test-resources/sap/ui/qunit/testrunner.html"]

SAP target CSP middleware options

Type:
  • object