Skip to content

Instantly share code, notes, and snippets.

@chanakaudaya
Created June 9, 2018 04:04
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/bf38a28a6b6b43911d7f2b1a2c65951a to your computer and use it in GitHub Desktop.
Save chanakaudaya/bf38a28a6b6b43911d7f2b1a2c65951a to your computer and use it in GitHub Desktop.
import ballerina/http;
@http:ServiceConfig {
basePath: "/"
}
service<http:Service> hello bind {port:9090} {
@http:ResourceConfig {
path: "/service1",
methods: ["POST"]
}
hi (endpoint caller, http:Request request) {
http:Response res;
json j = {
id: 200,
name: "IBM",
price: 234.34
};
res.setJsonPayload(j, contentType = "application/json");
_ = caller->respond(res);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment