Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added FeedController and FeedCategoryController
- Loading branch information
1 parent
f7749ca
commit 5cd8c09
Showing
4 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
api/src/main/java/com/demo/imagebrowser/controller/FeedCategoryController.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.demo.imagebrowser.controller; | ||
|
||
import com.demo.imagebrowser.domain.FeedCategory; | ||
import com.demo.imagebrowser.service.FeedService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/secure/category") | ||
public class FeedCategoryController { | ||
|
||
@Autowired | ||
private FeedService feedService; | ||
|
||
@RequestMapping(method = RequestMethod.PUT) | ||
public ResponseEntity<FeedCategory> addCategory(@RequestParam() String categoryName) { | ||
FeedCategory category = feedService.addCategory(categoryName); | ||
return new ResponseEntity<>(category, HttpStatus.OK); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
api/src/main/java/com/demo/imagebrowser/controller/FeedController.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.demo.imagebrowser.controller; | ||
|
||
import com.demo.imagebrowser.domain.Feed; | ||
import com.demo.imagebrowser.service.FeedService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/feed") | ||
public class FeedController { | ||
|
||
@Autowired | ||
private FeedService feedService; | ||
|
||
@ResponseBody | ||
@RequestMapping(method = RequestMethod.GET) | ||
public List<Feed> getFeeds() { | ||
return feedService.getAll(); | ||
} | ||
} |
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
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