Skip to content

@ui5/server

Methods

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

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

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

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
liveReloadbooleanoptionalfalseAutomatically reload connected browsers when project sources change
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'
cachestringoptional"Default"Cache mode to use for building UI5 projects.
ui5DataDirstringoptionalExplicit UI5 data directory to use for the build cache.
Overrides the UI5_DATA_DIR environment variable,
the UI5 configuration file, and the default of ~/.ui5.
includedTasksArray<string>optionalA list of tasks to be added to the default execution set.
Takes precedence over excludedTasks.
excludedTasksArray<string>optionalA list of tasks to be excluded from the default task
execution set.
errorfunctionError callback. Will be called when an error occurs outside of request handling.
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 103

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