Server constructor
Constructor
Creates a new Server.
After creation, a typical application should:
- change the bindPort;
- optionally change the bindAddress (when not deployed with a reverse proxy);
- configure the first pipeline with handlers;
- optional create and configure additional pipelines;
- define a server-level exceptionHandler;
and then invoke the run method to start the Web server.
By default this constructor creates the first pipeline in pipelines.
Since all Web servers would need at least one pipeline; and simple
applications usually don't need more than one pipeline. But
numberOfPipelines
can be set to zero or a number greater than one, to
create that number of pipelines.
There is nothing special about these initial pipelines. The application can also create them and add them to the pipelines list.
Implementation
Server({int numberOfPipelines = 1}) {
for (var x = 0; x < numberOfPipelines; x++) {
pipelines.add(new ServerPipeline());
}
}