Class ArticlesController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.ArticlesController
@RequestMapping("/api/Articles")
@RestController
public class ArticlesController
extends ApiController
This is a REST controller for Articles
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all articlesdeleteArticles(Long id) Delete an articleGet a single article by idpostArticles(String title, String url, String explanation, String email, LocalDateTime dateAdded) Create a new articleupdateArticles(Long id, @Valid Articles incoming) Update a single articleMethods inherited from class ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
ArticlesController
public ArticlesController()
-
-
Method Details
-
allArticles
-
postArticles
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/post") public Articles postArticles(@RequestParam String title, @RequestParam String url, @RequestParam String explanation, @RequestParam String email, @RequestParam("dateAdded") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateAdded) Create a new article- Parameters:
title- the title of the articleurl- the url of the articleexplanation- why the article is interestingemail- the email of the person who added itdateAdded- the date added (iso format)- Returns:
- the saved article
-
getById
-
updateArticles
-
deleteArticles
-