|
|
|
@ -6,8 +6,11 @@ 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.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
@SpringBootApplication
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@ -29,4 +32,10 @@ public class DemoApplication {
|
|
|
|
personRepository.save(personData);
|
|
|
|
personRepository.save(personData);
|
|
|
|
return personRepository.findAll();
|
|
|
|
return personRepository.findAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@DeleteMapping(value = "/people/{id}")
|
|
|
|
|
|
|
|
public Iterable<Person> delete(@PathVariable int id) {
|
|
|
|
|
|
|
|
personRepository.deleteById(id);
|
|
|
|
|
|
|
|
return personRepository.findAll();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|