ApiService class

A Service that serves HTTP-Requests by calling the provided ApiEndpoints.

The ApiService uses the datahub HTTPServer, therefore supports HTTP 1.1 and HTTP 2 connections.

Configuration values:

  • address: the address the HTTP-Server listens to, null means any (default null)
  • port: the port the HTTP-Server listens on (default 8080)
  • enableMetrics: enable default metrics (default true)
  • metricPrefix: prefix for default metrics (default "api")
Inheritance

Constructors

ApiService.new(String? config, List<ApiEndpoint> endpoints, {MiddlewareBuilder? middleware, String? apiBasePath, SecurityContext? securityContext})

Properties

address String?
latefinal
basePath String
final
configPath ConfigPath?
finalinherited
endpoints List<ApiEndpoint>
final
environment Environment
Fetch the environment configuration from ConfigService.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
middleware MiddlewareBuilder?
final
port int
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
securityContext SecurityContext?
final

Methods

config<T>(String path) → T
Fetches a configuration value from ConfigService.
inherited
configObject<T extends TransferObjectBase>(String path, TransferBean<T> bean) → T
Fetches a configuration value from ConfigService and parse it into the TransferObject.
inherited
handleRequest(HttpRequest httpRequest) Future<HttpResponse>
initialize() Future<void>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shutdown() Future<void>
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited