|
|
|
@ -5,7 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
@SpringBootApplication
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@ -21,4 +23,10 @@ public class DemoApplication {
|
|
|
|
public Iterable<Person> index() {
|
|
|
|
public Iterable<Person> index() {
|
|
|
|
return personRepository.findAll();
|
|
|
|
return personRepository.findAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(path="/people")
|
|
|
|
|
|
|
|
public Iterable<Person> create (@RequestBody Person personData) {
|
|
|
|
|
|
|
|
personRepository.save(personData);
|
|
|
|
|
|
|
|
return personRepository.findAll();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|