Files
linguist/samples/Ballerina/hello-world-service.bal
Shan Mahanama c2d558b71d Add Ballerina language (#3818)
* Add Ballerina language

* Add missing file

* Update color

* Update with required changes

* Update sub-module
2017-09-17 13:29:12 +01:00

17 lines
806 B
Ballerina

import ballerina.lang.messages;
import ballerina.net.http;
import ballerina.doc;
@doc:Description {value:"By default Ballerina assumes that the service is to be exposed via HTTP/1.1 using the system default port and that all requests coming to the HTTP server will be delivered to this service."}
service<http> helloWorld {
@doc:Description {value:"All resources are invoked with an argument of type message, the built-in reference type representing a network invocation."}
resource sayHello (message m) {
// Creates an empty message.
message response = {};
// A util method that can be used to set string payload.
messages:setStringPayload(response, "Hello, World!");
// Reply keyword sends the response back to the client.
reply response;
}
}