delete route

pull/1/head
Matt Huntington 5 years ago
parent ad4f77ade6
commit 126a01d43b

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

Loading…
Cancel
Save