Tutorial by Java Brains
From the course page description:
"Learn how to create full end-to-end Spring applications using Spring Boot"
- Project: Maven
- Java: 16
- Spring Boot: 2.4.5
- Dependencies
- Spring Web
- Spring Boot Starter Test
- Apache Derby
- Spring Data JPA
- Spring Security
- Bucket4j Spring Boot Starter
- Spring Cache Abstraction
- Ehcache
- Plugins
- Spring Boot Maven Plugin
- Heroku Maven Plugin
GET /hello
Hi!
Retrieves a list of all topics.
GET /topics
[
{
"id": "topic-a",
"name": "Topic A Name",
"description": "Topic A Description"
},
{
"id": "topic-b",
"name": "Topic B Name",
"description": "Topic B Description"
}
]
Retrieves one topic.
GET /topics/:id
{
"id": "topic",
"name": "Topic Name",
"description": "Topic Description"
}
Add a new topic to the application.
POST /topics
{
"id": "topic",
"name": "Topic Name",
"description": "Topic Description"
}
Update topic information (name and/or description).
PUT /topics/:id
{
"id": "topic",
"name": "New Topic Name",
"description": "New Topic Description"
}
Remove topic from the application.
DELETE /topics/:id
Retrieves a list of all courses, regardless of Topic ID.
GET /courses
[
{
"id": "course-a",
"name": "Course A Name",
"description": "Course A Description",
"topic": {
"id": "topic-a",
"name": "Topic A Name",
"description": "Topic A Description"
}
},
{
"id": "course-b",
"name": "Course B Name",
"description": "Course B Description",
"topic": {
"id": "topic-b",
"name": "Topic B Name",
"description": "Topic B Description"
}
}
]
Retrieves a list of all courses with a specific topic.
GET /topics/:topicId/courses
[
{
"id": "course-a",
"name": "Course A Name",
"description": "Course A Description",
"topic": {
"id": "topic-a",
"name": "Topic A Name",
"description": "Topic A Description"
}
},
{
"id": "course-b",
"name": "Course B Name",
"description": "Course B Description",
"topic": {
"id": "topic-a",
"name": "Topic A Name",
"description": "Topic A Description"
}
}
]
Retrieves one course.
GET /topics/:topicId/courses/:id
{
"id": "course",
"name": "Course Name",
"description": "Course Description"
}
Add a new course to the application.
POST /topics/:topicId/courses
{
"id": "course",
"name": "Course Name",
"description": "Course Description"
}
Update course information (name and/or description).
PUT /topics/:topicId/courses/:id
{
"id": "course",
"name": "New Course Name",
"description": "New Course Description"
}
Remove course from the application.
DELETE /topics/:topicId/courses/:id
Retrieves a list of all lessons, regardless of Topic ID and Course ID.
GET /lessons
[
{
"id": "lesson-a",
"name": "Lesson A Name",
"description": "Lesson A Description",
"course": {
"id": "course",
"name": "Course Name",
"description": "Course Name Description",
"topic": {
"id": "topic",
"name": "Topic Name",
"description": "Topic Name Description"
}
}
}
]
Retrieves a list of all lessons with a specific course and topic.
GET /topics/:topicId/courses/:courseId/lessons
[
{
"id": "lesson-a",
"name": "Lesson A Name",
"description": "Lesson A Description",
"course": {
"id": "course",
"name": "Course Name",
"description": "Course Name Description",
"topic": {
"id": "topic",
"name": "Topic Name",
"description": "Topic Name Description"
}
}
},
{
"id": "lesson-b",
"name": "Lesson B Name",
"description": "Lesson B Description",
"course": {
"..."
}
}
]
Retrieves one lesson.
GET /topics/:topicId/courses/:courseId/lessons/:id
{
"id": "lesson-a",
"name": "Lesson A Name",
"description": "Lesson A Description",
"course": {
"id": "course",
"name": "Course Name",
"description": "Course Name Description",
"topic": {
"id": "topic",
"name": "Topic Name",
"description": "Topic Name Description"
}
}
}
Add a new lesson to the application.
POST /topics/:topicId/courses/:courseId/lesson
{
"id": "lesson",
"name": "Lesson Name",
"description": "Lesson Description",
}
Update course information (name and/or description).
PUT /topics/:topicId/courses/:courseId/lessons/:id
{
"id": "lesson",
"name": "New Lesson Name",
"description": "New Lesson Description",
}
Remove lesson from the application.
DELETE /topics/:topicId/courses/:courseId/lessons/:id
- Get Course by ID request ignores
topicId
(no verification is done) - Get Lesson by ID request ignores
topicId
andcourseId
(no verification is done) - Update Topic request ignores
id
. so a new topic is created if a new id is provided in the request body - Update Course request ignores
id
. so a new course is created if a new id is provided in the request body - Update Lesson request ignores
id
. so a new lesson is created if a new id is provided in the request body - Before a topic is deleted, all of its courses must be deleted first
- Before a course is deleted, all of its lessons must be deleted first
API deployed on Heroku