import ballerina/http;
service /demo on new http:Listener(8080) {
// Here is how you can make path segments as parameters.
resource function get greeting/hello/[string name]() returns string {
return "Hello, " + name;
}
}
Resource path parametersPath segments can be treated as parameters in Ballerina. |
import ballerina/http;
service /demo on new http:Listener(8080) {
resource function get greeting/hello/[string name]() returns string {
Here is how you can make path segments as parameters.
return "Hello, " + name;
}
}
bal run resource_path_parameters.bal
# Run this cURL command to invoke the resource.
curl "localhost:8080/demo/greeting/hello/Ballerina"
Hello, Ballerina