Created
June 9, 2018 04:05
-
-
Save chanakaudaya/714a1dac25beff34733fac4e1d86f3cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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