Building a REST API and Journal App
Objectives:
- Learn about REST APIs
- Connect with MongoDB
- Understand Spring Security
- Create a project (Journal App)
- Add API, database connection, and user login/logout to the project
Project Initiation:
- Create a Spring Boot project
- Delete the previous project and start a new one
- Project name: Journal App
Using Spring Initializr:
- Select Java Maven
- Choose an older version for more support and resources
- Set group and artifact IDs
Project Setup:
- Add Spring Web dependency
- Download and extract the project
Understanding REST API:
- REST stands for Representational State Transfer
- API stands for Application Programming Interface
- HTTP Verbs: GET, POST, PUT, DELETE
Structuring Endpoints:
- Use controllers and REST controllers
- Map the endpoints
Journal Entry Class:
- Create a class for Journal Entry
- Private variables for ID, title, and content
API Routes:
- Create routes for GET, POST, PUT, DELETE
- Processes to map, store, and retrieve data
Using Postman:
- Use Postman to hit the API
- Test various operations (GET, POST, etc.)
Error Handling and Debugging:
- Focus on resolving different errors
- Run and test the project correctly
At the end of this lecture, a journaling app has been prepared using Spring Boot that supports various REST API operations. The next steps will involve integrating the database and security.