WebServer class
The Serverpod webserver.
Constructors
- WebServer({required Serverpod serverpod, SecurityContext? securityContext})
- Creates a new webserver.
Properties
- fallbackRoute ← Route
-
Sets a fallback
routeto use if no other registered Route matches a request.no getter - hasApp → bool
-
Whether the RelicApp has been created.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- port → int?
-
The port the webserver is listening on, or null if not started.
no setter
- router → RelicRouter
-
Get access to the full RelicRouter for advanced use-cases.
no setter
- running → bool
-
Returns true if the webserver is currently running.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverId → String
-
The server id of this server.
final
- serverpod → Serverpod
-
Reference to the Serverpod this webserver is associated with.
final
Methods
-
addMiddleware(
Middleware middleware, String path, {String? host}) → void -
Adds a Middleware to the server for all routes below
path. -
addRoute(
Route route, [String path = '/']) → void -
Adds
routeto the server atpath. -
logDebug(
String msg) → void - Logs a debug message.
-
logError(
Object e, {StackTrace? stackTrace}) → void - Logs an error.
-
logInfo(
String msg) → void - Logs an info message.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setDevModeForTesting(
bool devMode) → void - Enables or disables dev mode for testing purposes.
-
start(
) → Future< bool> - Starts the webserver. Returns true if the webserver was started successfully.
-
stop(
) → Future< void> - Stops the webserver.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited