diff --git a/ReadMe.md b/ReadMe.md
new file mode 100644
index 0000000..34d4623
--- /dev/null
+++ b/ReadMe.md
@@ -0,0 +1,7 @@
+# REST-API APP
+This is a project to showcase the rest API using Spring boot. It allows you to add, view, update and remove film titles.
+## spring Boot
+The use of spring data jpa, hibernate as one of the technologies used.
+### MYSQL
+database used to store data.
+#### maven.
diff --git a/pom.xml b/pom.xml
index 8f9fb82..807f047 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,12 @@
+
+
+ com.github.javafaker
+ javafaker
+ 1.0.2
+
diff --git a/src/main/java/com/birichani/code/restapi/api/VideoApiController.java b/src/main/java/com/birichani/code/restapi/api/VideoApiController.java
index 9739c7d..bfbd514 100644
--- a/src/main/java/com/birichani/code/restapi/api/VideoApiController.java
+++ b/src/main/java/com/birichani/code/restapi/api/VideoApiController.java
@@ -1,39 +1,46 @@
package com.birichani.code.restapi.api;
+import com.birichani.code.restapi.constant.ErrorMessage;
+import com.birichani.code.restapi.constant.InfoMessage;
import com.birichani.code.restapi.model.Video;
import com.birichani.code.restapi.repository.VideoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
+@RequestMapping("/videos")
@RestController
public class VideoApiController {
- private VideoRepository videoRepository;
-
+ private final VideoRepository videoRepository;
@Autowired
public VideoApiController(VideoRepository videoRepository) {
this.videoRepository = videoRepository;
}
-
- @GetMapping("/Getvideos/{videoTopic}")
- public String video(@PathVariable String videoTopic) {
-
- switch(videoTopic) {
- case"python":
-
- return String.format("This is our python contents") ;
- case "java":
- return String.format("This is our java contents") ;
+
+ @GetMapping("/{videoTopic}")
+ public String video (@PathVariable String videoTopic) {
+ String message;
+
+ switch (videoTopic) {
+ case "python":
+ message = InfoMessage.PYTHON_RESPONSE_MESSAGE;
+ break;
+ case "java":
+ message = InfoMessage.JAVA_RESPONSE_MESSAGE;
+ break;
default:
- return String.format("sorry,Incorrect input") ;
-
+
+
+ message = ErrorMessage.VIDEO_TOPIC_SELECTION_MESSAGE;
}
-
+
+ return message;
}
- @GetMapping("/GetAll")
+ @GetMapping()
public List