Skip to content

Instantly share code, notes, and snippets.

@chanakaudaya
Created June 9, 2018 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chanakaudaya/714a1dac25beff34733fac4e1d86f3cf to your computer and use it in GitHub Desktop.
Save chanakaudaya/714a1dac25beff34733fac4e1d86f3cf to your computer and use it in GitHub Desktop.
import ballerina/http;
@http:ServiceConfig {
basePath: "/"
}
service<http:Service> hello bind {port:9091} {
@http:ResourceConfig {
path: "/service2",
methods: ["POST"]
}
hi (endpoint caller, http:Request request) {
http:Response res;
json j = {
name: "IBM",
industry: "technology",
CEO: "John Doe",
Revenue: "23.5 billion USD"
};
res.setJsonPayload(j, contentType = "application/json");
//res.setTextPayload("Hello "+payload+"!\n");
_ = caller->respond(res);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment