Created
February 7, 2023 17:42
-
-
Save SuvidhaMalaviya/df34d49a6f2d9777ebf464f00c931047 to your computer and use it in GitHub Desktop.
Controller
This file contains 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
@RestController | |
public class EmployeeController { | |
@Autowired | |
private EmployeeRepository repository; | |
@GetMapping("/employees") | |
public List<Employee> getAllEmployees() { | |
return repository.findAll(); | |
} | |
@PostMapping("/employees") | |
public Employee createEmployee(@RequestBody Employee employee) { | |
return repository.save(employee); | |
} | |
// other methods to handle the CRUD operations | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment