new WebServer(logger)
Parameters:
Name | Type | Description |
---|---|---|
logger |
olympe.logging.Channel |
Members
-
<protected, non-null> logger :olympe.logging.Channel
-
Type:
- olympe.logging.Channel
Methods
-
addRoute(id, path, methods, handler)
-
Add a new route to the webservice, and start the web server. It restarts the server if already started before.
Parameters:
Name Type Description id
string path
string methods
Array.<!olympe.net.Http.Method> handler
function Returns:
- Type
- Promise.<void>
-
removeRoute(id)
-
Remove the route previously added with the specified id.
Parameters:
Name Type Description id
string Returns:
- Type
- Promise.<void>
-
setCorsPolicies(methods, allowedHeaders)
-
Define the CORS policies for the web server.
Parameters:
Name Type Description methods
Array.<!olympe.net.Http.Method> allowedHeaders
Array.<!olympe.net.Http.Headers> Returns:
this
- Type
- olympe.net.WebServer