Permalink
Browse files

Hello API

  • Loading branch information...
abdennour
abdennour committed Jul 19, 2018
1 parent 623e36f commit 1b45ff338963b04fe75e1e3a2c12493f1ea23108
Showing with 27 additions and 0 deletions.
  1. +27 −0 hello_api.bal
View
@@ -0,0 +1,27 @@
import ballerina/http;
import ballerina/log;
endpoint http:Listener helloListener {
port:8888
};
// Yes, you can define many endpoints and bind them with services
endpoint http:Listener myListener {
port:7070
};
@http:ServiceConfig {
basePath: "/"
}
service<http:Service> hello bind helloListener {
sayHello (endpoint caller, http:Request request) {
http:Response response = new;
response.setPayload("Hello API from elegance.abdennoor.com!");
// Ignore errors by using "_"
_ = caller -> respond(response);
// To Handle error, uncomment the following instructions
// caller ->respond(res) but {
// error e => log:printError("Error sending response", err = e)
// };
}
}

0 comments on commit 1b45ff3

Please sign in to comment.