Modules

http

http.default

Module http.default

tharmigank/http.default

0.1.0

Overview

This module provides a default HTTP listener implementation. The default HTTP listener is a built-in listener that can be used to attach multiple services. Additionally, the default listener configuration can be customized.

Usage

Following is an example of using the default HTTP listener to start an HTTP server.

Copy
import ballerina/http.default;

service /api on default:httpListener {

    resource function get greeting() returns string {
        return "Hello, World!";
    }
}

The default listener port is defaulted to 9090. The port can be changed in the Config.toml file.

Copy
[ballerina.http.default]
listenerPort = 8080

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

Copy
[ballerina.http.default.listenerConfig]
httpVersion = "1.1"

[ballerina.http.default.listenerConfig.secureSocket.key]
path = "resources/certs/key.pem"
password = "password"

Import

import tharmigank/http.default;Copy

Metadata

Released date: 4 months ago

Version: 0.1.0


Compatibility

Platform: any

Ballerina version: 2201.10.3

GraalVM compatible: Yes


Pull count

Total: 4

Current verison: 1


Weekly downloads


Other versions

See more...