-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentApiController.java
More file actions
24 lines (21 loc) · 946 Bytes
/
StudentApiController.java
File metadata and controls
24 lines (21 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.app.backend.controller;
import com.app.backend.model.StudentModel;
import com.app.backend.service.impl.StudentServiceImpl;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RequestMapping("/")
public interface StudentApiController {
@GetMapping("/students")
public List<StudentModel> getAllStudents();
@PostMapping("/newStudent")
public StudentModel createStudent(@RequestBody StudentModel newStudent);
@GetMapping("/students/{id}")
public StudentModel getStudentById(@PathVariable int id);
@PutMapping("/update-student/{id}")
public ResponseEntity<String> updateStudentById(@PathVariable int id, @RequestBody StudentModel newStudent);
@DeleteMapping("delete-student/{id}")
public ResponseEntity<String> deleteStudentById(@PathVariable int id);
}