100 Days of Java challenges
Day 48 - Spring Boot: REST API with Spring MVC
- Learn the basics of Spring MVC's Model-View-Controller (MVC) architecture for building REST APIs. Explore controllers, handling requests and responses, and data binding.
- Building a Simple API: Implement a controller in your Spring Boot application to expose a RESTful API endpoint that returns a JSON object containing name, email and age.
- Use annotations @RestController and @RequestMapping to define the controller and endpoint and @GetMapping to handle GET requests
- RESTful API Design: Learn about RESTful principles and how to design well-structured APIs. This includes using appropriate HTTP methods (GET, POST, PUT, DELETE) for different operations on resources. Implement the following APIs on the User class. Use a simple HashMap to store the Users details.
- [GET] An API with path variable /user/{id} which returns the user details with id
- [POST] An API with path variable /user which creates a new User and adds to the Hashmap and then returns the user details
- [PUT] An API with path variable /user/{id} which updates the user details with id
- [DELETE] An API with path variable /user/{id} which deletes the user details with id from the HashMap
Community|Blog|Youtube|Careers|Contact Us
Have Feedback or want to contribute? Email: hello[@]100DaysOfCode.io
100DaysOfCode@2024