Created
June 19, 2021 08:23
-
-
Save learnit-codeit/7ffa00769540feb30d0d9a6c69de3216 to your computer and use it in GitHub Desktop.
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
@Controller | |
@RequestMapping("/rest") | |
public class MyController { | |
@GetMapping("/get") | |
public ResponseEntity<String> getExample() { | |
return new ResponseEntity<String>("Get Example", HttpStatus.OK); | |
} | |
@GetMapping("/getvar/{id}") | |
public ResponseEntity<String> getExampleWithVariable(@PathVariable String id){ | |
return new ResponseEntity<String>("Get With Variable Example" +id,HttpStatus.OK); } | |
@PostMapping("/post") | |
public ResponseEntity<String> postExample() { | |
return new ResponseEntity<String>("Post Example", HttpStatus.OK); | |
} | |
@PutMapping("/put") | |
public @ResponseBody ResponseEntity<String> putExample() { | |
return new ResponseEntity<String>("Put Example", HttpStatus.OK); | |
} | |
@DeleteMapping("/delete") | |
public ResponseEntity<String> deleteExample() { | |
return new ResponseEntity<String>("Delete Example", HttpStatus.OK); | |
} | |
@PatchMapping("/patch") | |
public ResponseEntity<String> patchPerson() { | |
return new ResponseEntity<String>("Patch Example", HttpStatus.OK); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment