Created
March 23, 2019 11:21
-
-
Save madan712/aef8ffc1a724ca0e5e0c0c27f737103b to your computer and use it in GitHub Desktop.
ApplicationController.java - Spring Boot + ReactJS hello world example
This file contains hidden or 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 com.javaxp; | |
import org.springframework.web.bind.annotation.CrossOrigin; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
public class ApplicationController { | |
@CrossOrigin(origins = {"http://localhost:3000"}) | |
@GetMapping("/sayhello") | |
public String sayHello(@RequestParam(value = "name", defaultValue = "world") String name) { | |
return "Hello "+name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment