๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ199

2. User Service API ๊ตฌํ˜„ User ๋„๋ฉ”์ธ ํด๋ž˜์Šค ์ƒ์„ฑ ๋„๋ฉ”์ธ ํŠน์ • ์ „๋ฌธ ๋ถ„์•ผ์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์ „๋ฌธ ์ง€์‹ ์Šคํ…Œ๋ ˆ์˜คํƒ€์ž… ํ•ด๋‹น ํด๋ž˜์Šค๊ฐ€ ์–ด๋Š ์šฉ๋„๋กœ ์‚ฌ์šฉ๋  ๊ฒƒ์ธ์ง€ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฒƒ → ์˜์กด์„ฑ ์ฃผ์ž…์— ๋„์›€๋œ๋‹ค. ex) @RestController, @Service POST @RequestBody ๋ฅผ ์„ ์–ธํ•ด ํ˜„์žฌ variable์ด requestbody ํ˜•์‹์œผ๋กœ ๋“ค์–ด์˜จ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๋ฆผ HTTP Status Code 2XX → OK 4XX → Client 5XX → Server @ServletUriComponentsBuilder๋ฅผ ์ด์šฉํ•ด ํ˜ธ์ถœ ๋ฐฉ๋ฒ•์— ๋”ฐ๋ผ ์ ์ ˆํ•œ status code๋ฅผ ๋ฐ˜ํ™˜ํ•จ @PostMapping("/users") public ResponseEntity createUser(@RequestBody User user){ User save.. 2023. 6. 20.
1. Spring Boot๋กœ ๊ฐœ๋ฐœํ•˜๋Š” RESTful Service ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ dependency ⇒ pom.xml JPA Spring web → embedded tomcat ์‹คํ–‰ ๊ฐ€๋Šฅ REST API ์„ค๊ณ„ User → Posts ๊ตฌ์กฐ ํ™•์ธ application.properties → yml ํŒŒ์ผ๋กœ! ์Šคํ”„๋ง ๋ถ€ํŠธ ํ™˜๊ฒฝ์„ค์ • ์ง€์ • pom.xml ์ „์ฒด ํ”„๋กœ์ ํŠธ์— ํ•„์š”ํ•œ maven ์„ค์ • Controller RESTController ํด๋ž˜์Šค๋กœ ์ž‘๋™ํ•จ(์ผ๋ฐ˜ MVC Controller์™€๋Š” ๋‹ค๋ฆ„) @RestController Mapping // GET @RequestMapping(method=RequestMethod.GET, path="/hello-world") @GetMapping(path = "/hello-world")/ Bean ์Šคํ”„๋ง์—์„œ ์„ ์–ธ๋˜์–ด ๊ด€๋ฆฌ๋˜๋Š” ์ธ์Šคํ„ด์Šค ⇒ ์˜์กด์„ฑ.. 2023. 6. 20.
0. Web Service & Web Application ์›น ์„œ๋น„์Šค ๋„คํŠธ์›Œํฌ ์ƒ์—์„œ ์„œ๋กœ ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ ์ปดํ“จํ„ฐ๋“ค ๊ฐ„์— ์ƒํ˜ธ์ž‘์šฉํ•˜๊ธฐ ์œ„ํ•œ ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ SOAP VS REST 1) SOAP(Simple object access protocol) XML ๊ธฐ๋ฐ˜ envelope - header - body ⇒ overhead ์‹ฌํ•จ 2) REST(REpresentational State Transfer) Resource์˜ representation์— ์˜ํ•œ (์ž์›์˜) ์ƒํƒœ ์ „๋‹ฌ HTTP Method๋ฅผ ํ†ตํ•ด Resource๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์•„ํ‚คํ…์ณ RESTful : REST API๋ฅผ ์ œ๊ณตํ•˜๋Š” ์›น ์„œ๋น„์Šค REST HTTP HTTP Methods : ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ ์ „๋‹ฌํ•˜๊ฒŒ ๋˜๋Š” ๋ชฉ์ ์ด๋‚˜ ์ข…๋ฅ˜๋ฅผ ์•Œ๋ ค์ฃผ๋Š” ์ˆ˜๋‹จ HTTP Status Codes : ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์š”์ฒญํ•œ ์ •๋ณด.. 2023. 6. 20.
[ALGO] BFS dist ๋ฐฐ์—ด ํ™œ์šฉ ๋ฌธ์ œ ๋ฌธ์ œ ์ž๊พธ ๊ฑฐ๋ฆฌ ๊ด€๋ จ bfs ๋‚˜์˜ฌ ๋•Œ๋งˆ๋‹ค ์ฒ˜๋ฆฌ๋ฅผ ์ด์ƒํ•˜๊ฒŒ ํ•จ ์˜ค๋Š˜์˜ ์‚ฝ์งˆ ๋น„๊ต๋ฌธ์—์„œ๋ถ€ํ„ฐ dist ๊ฐ’์„ ๋”ฐ์ง€๊ณ  ์•‰์•„์žˆ์Œ if (dist[nx][ny] >= dist[x][y] + 1) continue; ํ•ด๊ฒฐ ๊ทธ๋ƒฅ 0 ์ด์ƒ์ธ์ง€๋งŒ ์ฒดํฌํ•ด์ค€๋‹ค (๋ฌผ๋ก ! ์ž…๋ ฅ์—์„œ dist ์ฒ˜๋ฆฌ๋ฅผ ๋ฉ€์ฉกํ•˜๊ฒŒ ํ•ด์•ผ๊ฒ ์ฃ ???) if (dist[nx][ny] >= 0) continue; ๊ด€๋ จ ๋ฌธ์ œ https://www.acmicpc.net/problem/4179 4179๋ฒˆ: ๋ถˆ! ์ž…๋ ฅ์˜ ์ฒซ์งธ ์ค„์—๋Š” ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ๋‘ ์ •์ˆ˜ R๊ณผ C๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‹จ, 1 ≤ R, C ≤ 1000 ์ด๋‹ค. R์€ ๋ฏธ๋กœ ํ–‰์˜ ๊ฐœ์ˆ˜, C๋Š” ์—ด์˜ ๊ฐœ์ˆ˜์ด๋‹ค. ๋‹ค์Œ ์ž…๋ ฅ์œผ๋กœ R์ค„๋™์•ˆ ๊ฐ๊ฐ์˜ ๋ฏธ๋กœ ํ–‰์ด ์ฃผ์–ด์ง„๋‹ค. ๊ฐ๊ฐ์˜ ๋ฌธ์ž www.acmicpc.net https://ww.. 2023. 6. 20.