|
@@ -2,13 +2,23 @@ package com.zipcodewilmington.bakery.Controllers;
|
2
|
2
|
|
3
|
3
|
import com.zipcodewilmington.bakery.Models.Baker;
|
4
|
4
|
import com.zipcodewilmington.bakery.Repositories.BakerRepository;
|
|
5
|
+import org.springframework.beans.factory.annotation.Autowired;
|
5
|
6
|
import org.springframework.http.HttpStatus;
|
6
|
7
|
import org.springframework.http.ResponseEntity;
|
|
8
|
+import org.springframework.stereotype.Controller;
|
|
9
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
10
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
11
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
12
|
+import org.springframework.web.bind.annotation.RestController;
|
7
|
13
|
|
|
14
|
+@RestController
|
8
|
15
|
public class BakerController {
|
9
|
16
|
|
|
17
|
+
|
|
18
|
+ @Autowired
|
10
|
19
|
private BakerRepository bakerRepository;
|
11
|
20
|
|
|
21
|
+
|
12
|
22
|
public ResponseEntity<Iterable<Baker>> index() {
|
13
|
23
|
return new ResponseEntity<>(this.bakerRepository.findAll(), HttpStatus.OK);
|
14
|
24
|
}
|