Created
May 24, 2019 18:28
-
-
Save supunsandeeptha/7fbd91fc2e7a39761042ef16eafd7319 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
package controllers; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import play.libs.Json; | |
import play.mvc.Controller; | |
import play.mvc.Result; | |
public class HomeController extends Controller{ | |
public Result index() { | |
return ok(); | |
} | |
//addbook method | |
public Result sendName(){ | |
JsonNode body = request().body().asJson(); | |
String name = body.get("name").asText(); | |
System.out.println("Server has received the name " + name); | |
return ok(Json.toJson("Your name is //// this is from server " + name)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment