Content deleted Content added
Add REST API example |
|||
Line 112:
=== Workers ===
<syntaxhighlight>
import ballerina/http;
import ballerina/lang.'int;
Line 122 ⟶ 121:
// to avoid deadlocks.
public function main() {
@strand {thread: "any"}
worker w1 {
int w1val = checkpanic calculate("2*3");
Line 141:
// A worker can have an explicit return type, or else, if a return type is not mentioned,
// it is equivalent to returning ().
@strand {thread: "any"}
worker w2 {
int w2val = checkpanic calculate("17*5");
Line 161 ⟶ 162:
function calculate(string expr) returns int|error {
http:Client httpClient = check new ("https://api.mathjs.org");
return check 'int:fromString(
}
</syntaxhighlight>
=== gRPC Unary Blocking ===
|