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.

Copy
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.

Copy
[ballerina.common_listener]
httpPort = 8080

Additionally, you can configure all the listener configurations. Example configuration for changing the HTTP version to 1.1.

Copy
[ballerina.common_listener.httpListenerConfigs]
httpVersion = "1.1"

Import

import tharmigank/common_listener;Copy

Metadata

Released date: 2 months ago

Version: 0.1.0


Compatibility

Platform: any

Ballerina version: 2201.10.3

GraalVM compatible: Yes


Pull count

Total: 0

Current verison: 0


Weekly downloads


Other versions

0.1.0