Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import com.springbootdev.examples.microservices.courseservice.model.Course;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
public class CourseController
public Course getCourseBuId(@PathVariable("course_id") Integer courseId)
return new Course(1, "Bsc-IT", "English");
public List<Course> getAllCourses()
List<Course> courseList = new ArrayList<>();
courseList.add(new Course(1, "Bsc-IT", "English"));
courseList.add(new Course(2, "Bsc-CS", "English"));
courseList.add(new Course(3, "Msc-IT", "English"));
courseList.add(new Course(4, "Zend Certification", "English"));
return courseList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.