Module common_listener
tharmigank/common_listener
0.1.0
Ballerina Common Listener Package
This package provides common Ballerina listeners for various protocols.
These common listeners can be used to attach services from other Ballerina packages.
HTTP Listeners
Common HTTP Listener
Following is an example of using the common HTTP listener to start an HTTP server.
import ballerina/common_listener; service /api on common_listener:httpListener { resource function get greeting() returns string { return "Hello, World!"; } }
The common listener port is defaulted to 9090. You can configure the port in the Config.toml
file.
[ballerina.common_listener] httpPort = 8080
Additionally, you can configure all the listener configurations. Example configuration for changing the HTTP version to 1.1.
[ballerina.common_listener.httpListenerConfigs] httpVersion = "1.1"
Import
import tharmigank/common_listener;
Other versions
0.1.0