Skip to content

Instantly share code, notes, and snippets.

@madan712
Created March 23, 2019 11:21
Show Gist options
  • Save madan712/aef8ffc1a724ca0e5e0c0c27f737103b to your computer and use it in GitHub Desktop.
Save madan712/aef8ffc1a724ca0e5e0c0c27f737103b to your computer and use it in GitHub Desktop.
ApplicationController.java - Spring Boot + ReactJS hello world example
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