[Java/Spring] Spring으로 DELETE Api 만들기

Hyeri Park·2022년 7월 13일
0

JAVA/Spring 기초

목록 보기
8/22
post-thumbnail
post-custom-banner

1. DELETE API

  • annotation

2. DeleteMapping 예제

DeleteApiController.java

package com.example.put.controller;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class DeleteApiController {
	
	@DeleteMapping("/delete/{userId}")
	public void delete(@PathVariable String userId, @RequestParam String account) {
		System.out.println(userId);
		System.out.println(account);
	}
}

profile
Backend Developer
post-custom-banner

0개의 댓글