Book Image

Hands-On Full Stack Development with Spring Boot 2.0 and React

By : Juha Hinkula
Book Image

Hands-On Full Stack Development with Spring Boot 2.0 and React

By: Juha Hinkula

Overview of this book

Apart from knowing how to write frontend and backend code, a full-stack engineer has to tackle all the problems that are encountered in the application development life cycle, starting from a simple idea to UI design, the technical design, and all the way to implementing, testing, production, deployment, and monitoring. This book covers the full set of technologies that you need to know to become a full-stack web developer with Spring Boot for the backend and React for the frontend. This comprehensive guide demonstrates how to build a modern full-stack application in practice. This book will teach you how to build RESTful API endpoints and work with the data access Layer of Spring, using Hibernate as the ORM. As we move ahead, you will be introduced to the other components of Spring, such as Spring Security, which will teach you how to secure the backend. Then, we will move on to the frontend, where you will be introduced to React, a modern JavaScript library for building fast and reliable user interfaces, and its app development environment and components. You will also create a Docker container for your application. Finally, the book will lay out the best practices that underpin professional full-stack web development.
Table of Contents (24 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
Index

Chapter 3


Answer 1: REST is an architectural style for creating web services and it defines a set of constraints.

Answer 2: The easiest way to create RESTful web service with Spring Boot is to use Spring Data REST starter package. By default, the Spring Data REST finds all public repositories and creates automatically RESTful Web Services for your entities.

Answer 3: By sending a GET request to the endpoint of the entity. For example, if you have entity class called Car the Spring Data REST creates the endpoint called /cars that can be used to fetch all cars.

Answer 4: By sending a DELETE request to the endpoint of the individual entity item. For example, /cars/1 deletes an car with id 1.

Answer 5: By sending a POST request to the endpoint of the entity. The header must contain the Content-Type field with the value application/json and the new item will be embedded in the request body.

Answer 6: By sending a PATCH request to the endpoint of the entity. The header must contain the Content-Type field with the value application/json and the updated item will be embedded in the request body.

Answer 7: You have to annotate your repository using the @RepositoryRestResource annotation. The query parameters  are annotated using the @Param annotation.