<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: bezkoder</title>
    <description>The latest articles on DEV Community by bezkoder (@bezkoder).</description>
    <link>https://dev.to/bezkoder</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F535872%2F68ccfcc7-3286-4c2f-a05f-b8aea64c3d62.png</url>
      <title>DEV Community: bezkoder</title>
      <link>https://dev.to/bezkoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bezkoder"/>
    <language>en</language>
    <item>
      <title>JPA Many to One UniDirectional example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Tue, 11 Jan 2022 09:30:11 +0000</pubDate>
      <link>https://dev.to/bezkoder/jpa-many-to-one-unidirectional-example-20i3</link>
      <guid>https://dev.to/bezkoder/jpa-many-to-one-unidirectional-example-20i3</guid>
      <description>&lt;p&gt;In this tutorial, I will show you how to implement JPA Many to One UniDirectional mapping with Hibernate in a Spring Boot example using &lt;code&gt;@ManyToOne&lt;/code&gt; annotation. You'll know:&lt;/p&gt;

&lt;ul&gt;
        &lt;li&gt;How to configure Spring Data, JPA, Hibernate to work with Database&lt;/li&gt;
        &lt;li&gt;How to define Data Models and Repository interfaces for JPA Many-to-One relationship&lt;/li&gt;
    &lt;li&gt;Way to use Spring JPA to interact with Database for Many-to-One association&lt;/li&gt;
    &lt;li&gt;Way to create Spring Rest Controller to process HTTP requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full Article: &lt;a href="https://www.bezkoder.com/jpa-one-to-many/"&gt;JPA Many to One UniDirectional example&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span id="Way"&gt;JPA Many to One UniDirectional: Appropriate way to implement One To Many mapping&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;In a relational database, a One-to-Many relationship between table A and table B indicates that one row in table A links to many rows in table B, but one row in table B links to only one row in table A.&lt;/p&gt;

&lt;p&gt;For example, you need to design data model for a Tutorial Blog in which &lt;strong&gt;One&lt;/strong&gt; Tutorial has &lt;strong&gt;Many&lt;/strong&gt; Comments. So this is a One-to-Many association.&lt;/p&gt;

&lt;p&gt;You can map the child entities as a collection (List of &lt;code&gt;Comment&lt;/code&gt;s) in the parent object (&lt;code&gt;Tutorial&lt;/code&gt;), and JPA/Hibernate provides the &lt;a href="https://docs.oracle.com/javaee/7/api/javax/persistence/OneToMany.html"&gt;@OneToMany&lt;/a&gt; annotation for that case: only the parent-side defines the relationship. We call it unidirectional &lt;code&gt;@OneToMany&lt;/code&gt; association.&lt;/p&gt;

&lt;p&gt;Similarly, when only the child-side manage the relationship, we have unidirectional Many-to-One association with &lt;a href="https://docs.oracle.com/javaee/7/api/javax/persistence/ManyToOne.html"&gt;@ManyToOne&lt;/a&gt; annotation where the child (&lt;code&gt;Comment&lt;/code&gt;) has an entity object reference to its parent entity (&lt;code&gt;Tutorial&lt;/code&gt;) by mapping the Foreign Key column (&lt;code&gt;tutorial_id&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The most appropriate way to implement JPA/Hibernate One To Many mapping is unidirectional Many-to-One association with &lt;a href="https://docs.oracle.com/javaee/7/api/javax/persistence/ManyToOne.html"&gt;@ManyToOne&lt;/a&gt;. You can read Vlad Mihalcea's &lt;a href="https://vladmihalcea.com/the-best-way-to-map-a-onetomany-association-with-jpa-and-hibernate/"&gt;article&lt;/a&gt; for more details.&lt;/p&gt;

&lt;h2&gt;&lt;span id="JPA_Many_to_One"&gt;JPA Many to One UniDirectional example&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;We're gonna create a Spring project from scratch, then we implement JPA/Hibernate One to Many Mapping with &lt;code&gt;tutorials&lt;/code&gt; and &lt;code&gt;comments&lt;/code&gt; table as following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k7NOoHCB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4o3t19jjhmyuryiw766j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k7NOoHCB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4o3t19jjhmyuryiw766j.png" alt="jpa-many-to-one-diagram" width="460" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We also write Rest Apis to perform CRUD operations on the Comment entities.&lt;/p&gt;

&lt;p&gt;These are APIs that we need to provide:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id/comments&lt;/td&gt;
&lt;td&gt;create new Comment for a Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id/comments&lt;/td&gt;
&lt;td&gt;retrieve all Comments of a Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/comments/:id&lt;/td&gt;
&lt;td&gt;retrieve a Comment by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;/api/comments/:id&lt;/td&gt;
&lt;td&gt;update a Comment by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/comments/:id&lt;/td&gt;
&lt;td&gt;delete a Comment by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;delete a Tutorial (and its Comments) by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id/comments&lt;/td&gt;
&lt;td&gt;delete all Comments of a Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Assume that we've had &lt;strong&gt;tutorials&lt;/strong&gt; table like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XwQRVTyG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qff41qmmvt0ugsxv00w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XwQRVTyG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qff41qmmvt0ugsxv00w.png" alt="jpa-many-to-one-parent-table" width="300" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the example requests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create new Comments: POST &lt;code&gt;/api/tutorials/[:id]/comments&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KJGgYxCH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aiqvcwen538b7314np60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KJGgYxCH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aiqvcwen538b7314np60.png" alt="jpa-many-to-one-example-create-child-records" width="590" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;comments&lt;/strong&gt; table after that:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wnhEKfB3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s62qallvz5nmnp4wr7gr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wnhEKfB3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s62qallvz5nmnp4wr7gr.png" alt="jpa-many-to-one-child-table" width="210" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieve all Comments of specific Tutorial: GET &lt;code&gt;/api/tutorials/[:id]/comments&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bdI_N-WX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59hfpckp2idicw8k2s1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bdI_N-WX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59hfpckp2idicw8k2s1f.png" alt="jpa-many-to-one-example-spring-crud-retrieve" width="500" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete all Comments of specific Tutorial: DELETE &lt;code&gt;/api/tutorials/[:id]/comments&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9E7TYigl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coary1vd6nbw88qg8nq4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9E7TYigl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coary1vd6nbw88qg8nq4.png" alt="jpa-many-to-one-example-spring-crud-delete" width="500" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the &lt;strong&gt;comment&lt;/strong&gt; table, all Comments of Tutorial with id=2 were deleted:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jeMAAdAt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xptuxje1ns13ad8jio1v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jeMAAdAt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xptuxje1ns13ad8jio1v.png" alt="jpa-many-to-one-example-spring-crud-table-delete" width="200" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete a Tutorial: DELETE &lt;code&gt;/api/tutorials/[:id]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2rmtPyRw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/te5syo06mgnvhoxi7pmr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2rmtPyRw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/te5syo06mgnvhoxi7pmr.png" alt="jpa-many-to-one-example-spring-crud-delete-cascade" width="500" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---kE6PJDk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gu9odpobpvofm9j9h8n9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---kE6PJDk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gu9odpobpvofm9j9h8n9.png" alt="jpa-many-to-one-example-spring-crud-delete-parent-table" width="300" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All Comments of the Tutorial with id=3 were &lt;strong&gt;CASCADE&lt;/strong&gt; deleted automatically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8aArjicR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upnfokmwveq6cpsto10l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8aArjicR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upnfokmwveq6cpsto10l.png" alt="jpa-many-to-one-example-spring-crud-delete-cascade-table" width="200" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's build our Spring Boot One to Many CRUD example.&lt;/p&gt;

&lt;h2&gt;&lt;span id="Spring_Boot_Many_to_One"&gt;Spring Boot Many to One example&lt;/span&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;span id="Technology"&gt;Technology&lt;/span&gt;&lt;/h3&gt;

&lt;ul&gt;
        &lt;li&gt;Java 8&lt;/li&gt;
        &lt;li&gt;Spring Boot 2.6.2 (with Spring Web MVC, Spring Data JPA)&lt;/li&gt;
        &lt;li&gt;PostgreSQL/MySQL&lt;/li&gt;
        &lt;li&gt;Maven 3.8.1&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;&lt;span id="Project_Structure"&gt;Project Structure&lt;/span&gt;&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fMSutpzp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xw9ii4dpfssuyu57v29h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fMSutpzp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xw9ii4dpfssuyu57v29h.png" alt="jpa-many-to-one-example-hibernate-spring-boot-project-structure" width="300" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain it briefly.&lt;/p&gt;

&lt;p&gt;– &lt;code&gt;Tutorial&lt;/code&gt;, &lt;code&gt;Comment&lt;/code&gt; data model class correspond to entity and table &lt;em&gt;tutorials&lt;/em&gt;, &lt;em&gt;comments&lt;/em&gt;.&lt;br&gt;
– &lt;code&gt;TutorialRepository&lt;/code&gt;, &lt;code&gt;CommentRepository&lt;/code&gt; are interfaces that extends &lt;a href="https://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/JpaRepository.html"&gt;JpaRepository&lt;/a&gt; for CRUD methods and custom finder methods. It will be autowired in &lt;code&gt;TutorialController&lt;/code&gt;, &lt;code&gt;CommentController&lt;/code&gt;.&lt;br&gt;
– &lt;code&gt;TutorialController&lt;/code&gt;, &lt;code&gt;CommentController&lt;/code&gt; are &lt;a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RestController.html"&gt;RestController&lt;/a&gt;s which has request mapping methods for RESTful CRUD API requests.&lt;br&gt;
– Configuration for Spring Datasource, JPA &amp;amp; Hibernate in &lt;strong&gt;application.properties&lt;/strong&gt;.&lt;br&gt;
– &lt;strong&gt;pom.xml&lt;/strong&gt; contains dependencies for Spring Boot and MySQL/PostgreSQL/H2 database.&lt;/p&gt;

&lt;p&gt;– About &lt;strong&gt;exception&lt;/strong&gt; package, to keep this post straightforward, I won't explain it. For more details, you can read following tutorial:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/spring-boot-restcontrolleradvice/"&gt;@RestControllerAdvice example in Spring Boot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For step by step and Github, please visit:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/jpa-one-to-many/"&gt;https://www.bezkoder.com/jpa-one-to-many/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can apply this implementation in following tutorials:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-jpa-h2-example/"&gt;Spring JPA + H2 example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jpa-crud-rest-api/"&gt;Spring JPA + MySQL example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-postgresql-example/"&gt;Spring JPA + PostgreSQL example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-hibernate-oracle/"&gt;Spring JPA + Oracle example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-sql-server/"&gt;Spring JPA + SQL Server example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;span id="Further_Reading"&gt;Further Reading&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-jwt-authentication/"&gt;Secure Spring Boot App with Spring Security &amp;amp; JWT Authentication&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#reference"&gt;Spring Data JPA Reference Documentation&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-pagination-sorting-example/"&gt;Spring Boot Pagination and Sorting example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to add Pagination to this Spring project, you can find the instruction at:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/spring-boot-pagination-filter-jpa-pageable/"&gt;Spring Boot Pagination &amp;amp; Filter example | Spring JPA, Pageable&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To sort/order by multiple fields:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/spring-data-sort-multiple-columns/"&gt;Spring Data JPA Sort/Order by multiple Columns | Spring Boot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Handle Exception for this Rest APIs is necessary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-controlleradvice-exceptionhandler/"&gt;Spring Boot @ControllerAdvice &amp;amp; @ExceptionHandler example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-restcontrolleradvice/"&gt;@RestControllerAdvice example in Spring Boot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or way to write Unit Test for the JPA Repository:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/spring-boot-unit-test-jpa-repo-datajpatest/"&gt;Spring Boot Unit Test for JPA Repositiory with @DataJpaTest&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how to deploy this Spring Boot App on AWS (for free) with &lt;a href="https://www.bezkoder.com/deploy-spring-boot-aws-eb/"&gt;this tutorial&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;dockerize with &lt;a href="https://www.bezkoder.com/docker-compose-spring-boot-mysql/"&gt;Docker Compose: Spring Boot and MySQL example&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;way to upload an Excel file and store the data in MySQL database with &lt;a href="https://www.bezkoder.com/spring-boot-upload-excel-file-database/"&gt;this post&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;upload CSV file and store the data in MySQL with &lt;a href="https://www.bezkoder.com/spring-boot-upload-csv-file/"&gt;this post&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>spring</category>
      <category>todayilearned</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Spring Boot + Microsoft SQL Server: CRUD Operations example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Mon, 16 Aug 2021 09:35:11 +0000</pubDate>
      <link>https://dev.to/bezkoder/spring-boot-microsoft-sql-server-crud-operations-example-1jmj</link>
      <guid>https://dev.to/bezkoder/spring-boot-microsoft-sql-server-crud-operations-example-1jmj</guid>
      <description>&lt;p&gt;In this tutorial, we're gonna build a Spring Boot CRUD Operations example with Maven that use Spring Data JPA to interact with Microsoft SQL Server (MSSQL). You'll know:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Way to use SQL Server maven dependency in Spring Boot&lt;/li&gt;
        &lt;li&gt;How to configure Spring Data, JPA, Hibernate to work with Database&lt;/li&gt;
        &lt;li&gt;How to define Data Models and Repository interfaces&lt;/li&gt;
    &lt;li&gt;Way to create Spring Rest Controller to process HTTP requests&lt;/li&gt;
    &lt;li&gt;Way to use Spring Data JPA to interact with MSSQL Database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full Article: &lt;a href="https://www.bezkoder.com/spring-boot-sql-server/"&gt;Spring Boot + SQL Server: CRUD Operations example&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span id="Overview"&gt;Overview of Spring Boot + SQL Server example&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;We will build a Spring Boot CRUD Rest Apis using Spring Data JPA with SQL Server (MSSQL) Database for a Tutorial application in that:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Each Tutotial has id, title, description, published status.&lt;/li&gt;
    &lt;li&gt;Apis help to create, retrieve, update, delete Tutorials.&lt;/li&gt;
    &lt;li&gt;Apis also support custom finder methods such as find by published status or by title.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are APIs that we need to provide:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;/api/tutorials&lt;/td&gt;
&lt;td&gt;create new Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials&lt;/td&gt;
&lt;td&gt;retrieve all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;retrieve a Tutorial by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;update a Tutorial by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;delete a Tutorial by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/tutorials&lt;/td&gt;
&lt;td&gt;delete all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials/published&lt;/td&gt;
&lt;td&gt;find all published Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials?title=[keyword]&lt;/td&gt;
&lt;td&gt;find all Tutorials which title contains &lt;code&gt;keyword&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;We make CRUD operations &amp;amp; finder methods with Spring Data JPA's &lt;code&gt;JpaRepository&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The database will be SQL Server (MSSQL) by configuring project dependency &amp;amp; datasource.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;span id="Technology"&gt;Technology&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
        &lt;li&gt;Java 8&lt;/li&gt;
        &lt;li&gt;Spring Boot 2.5 (with Spring Web MVC, Spring Data JPA)&lt;/li&gt;
        &lt;li&gt;Microsoft SQL Server (MSSQL)&lt;/li&gt;
        &lt;li&gt;Maven 3.6.1&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;span id="Project_Structure"&gt;Project Structure&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zjmjKg4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0b4h8jxb18fjr6ekqxp2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zjmjKg4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0b4h8jxb18fjr6ekqxp2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain it briefly.&lt;/p&gt;

&lt;p&gt;– &lt;code&gt;Tutorial&lt;/code&gt; data model class corresponds to entity and table &lt;em&gt;tutorials&lt;/em&gt;.&lt;br&gt;
– &lt;code&gt;TutorialRepository&lt;/code&gt; is an interface that extends &lt;a href="https://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/JpaRepository.html"&gt;JpaRepository&lt;/a&gt; for CRUD methods and custom finder methods. It will be autowired in &lt;code&gt;TutorialController&lt;/code&gt;.&lt;br&gt;
– &lt;code&gt;TutorialController&lt;/code&gt; is a &lt;a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RestController.html"&gt;RestController&lt;/a&gt; which has request mapping methods for RESTful requests such as: &lt;em&gt;getAllTutorials&lt;/em&gt;, &lt;em&gt;createTutorial&lt;/em&gt;, &lt;em&gt;updateTutorial&lt;/em&gt;, &lt;em&gt;deleteTutorial&lt;/em&gt;, &lt;em&gt;findByPublished&lt;/em&gt;...&lt;br&gt;
– Configuration for Spring Datasource, JPA &amp;amp; Hibernate in &lt;strong&gt;application.properties&lt;/strong&gt;.&lt;br&gt;
– &lt;strong&gt;pom.xml&lt;/strong&gt; contains dependencies for Spring Boot and SQL Server.&lt;/p&gt;

&lt;h2&gt;&lt;span id="Run_Test"&gt;Run the Spring Boot + Microsoft SQL Server CRUD example&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Run Spring Boot application with command: &lt;code&gt;mvn spring-boot:run&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;tutorials&lt;/em&gt;&lt;/strong&gt; table will be automatically generated in Microsoft SQL Server Database.&lt;/p&gt;

&lt;p&gt;Create some Tutorials:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C6CY9H2E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-create-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C6CY9H2E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-create-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-create-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MSSQL &lt;code&gt;tutorials&lt;/code&gt; table after that:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jVXOfuu8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-create-tutorial-database.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jVXOfuu8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-create-tutorial-database.png" alt="spring-boot-sql-server-crud-example-mssql-create-tutorial-database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Retrieve All Tutorials:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gvthl9zX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-retrieve-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gvthl9zX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-retrieve-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-retrieve-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Retrieve a Tutorial by Id:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5LarId9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-retrieve-one-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5LarId9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-retrieve-one-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-retrieve-one-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update some Tutorials:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yqvp8AA0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-update-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yqvp8AA0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-update-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-update-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The table data is changed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kt7BSdq5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-update-tutorial-database.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kt7BSdq5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-update-tutorial-database.png" alt="spring-boot-sql-server-crud-example-mssql-update-tutorial-database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find all Tutorials which title contains string 'ring':&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CeclzJWa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-search-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CeclzJWa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-search-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-search-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find all &lt;em&gt;&lt;strong&gt;published&lt;/strong&gt;&lt;/em&gt; Tutorials:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PGYfi1QQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-find-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PGYfi1QQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-find-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-find-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Delete a Tutorial:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EkDLTimp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-one-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EkDLTimp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-one-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-delete-one-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kO3t8yy5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-one-tutorial-database.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kO3t8yy5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-one-tutorial-database.png" alt="spring-boot-sql-server-crud-example-mssql-delete-one-tutorial-database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Delete all Tutorials:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MFwipb9I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-tutorial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MFwipb9I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-tutorial.png" alt="spring-boot-sql-server-crud-example-mssql-delete-tutorial"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MSSQL database table is clean now:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G_ZzV2QB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-tutorial-database.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G_ZzV2QB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.bezkoder.com/wp-content/uploads/2021/08/spring-boot-sql-server-crud-example-mssql-delete-tutorial-database.png" alt="spring-boot-sql-server-crud-example-mssql-delete-tutorial-database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also test this Spring Boot App with Client in one of these posts:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="https://www.bezkoder.com/axios-request/"&gt;Simple HTTP Client using Axios&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/angular-crud-app/"&gt;Angular 8 CRUD Application example with Web API&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-crud-app/"&gt;Angular 10 CRUD Application example with Web API&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/angular-11-crud-app/"&gt;Angular 11 CRUD Application example with Web API&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/angular-12-crud-app/"&gt;Angular 12 CRUD Application example with Web API&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/vue-js-crud-app/"&gt;Vue 2 CRUD Application with Vue Router &amp;amp; Axios&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/vue-3-crud/"&gt;Vue 3 CRUD Application with Axios &amp;amp; Vue Router&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/react-crud-web-api/"&gt;React CRUD example to consume Web API&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/react-redux-crud-example/"&gt;React Redux CRUD example with API calls&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For step by step instruction and Github source code, please visit:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/spring-boot-sql-server/"&gt;Spring Boot + SQL Server: CRUD Operations example&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span id="Further_Reading"&gt;Further Reading&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;If you want to add Pagination to this Spring project, you can find the instruction at:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-boot-pagination-filter-jpa-pageable/"&gt;Spring Boot Pagination &amp;amp; Filter example | Spring JPA, Pageable&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To sort/order by multiple fields:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-data-sort-multiple-columns/"&gt;Spring Data JPA Sort/Order by multiple Columns | Spring Boot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Handle Exception for this Rest APIs is necessary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-controlleradvice-exceptionhandler/"&gt;Spring Boot @ControllerAdvice &amp;amp; @ExceptionHandler example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-restcontrolleradvice/"&gt;@RestControllerAdvice example in Spring Boot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or way to write Unit Test for the JPA Repository:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-boot-unit-test-jpa-repo-datajpatest/"&gt;Spring Boot Unit Test for JPA Repositiory with @DataJpaTest&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fullstack CRUD App:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-vue-js-crud-example/"&gt;Spring Boot + Vue.js example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-spring-boot-crud/"&gt;Angular 8 + Spring Boot example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-spring-boot-crud/"&gt;Angular 10 + Spring Boot example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-11-spring-boot-crud/"&gt;Angular 11 + Spring Boot example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-12-spring-boot-crud/"&gt;Angular 12 + Spring Boot example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-spring-boot-crud/"&gt;React + Spring Boot example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More Practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jwt-authentication/"&gt;Secure Spring Boot App with Spring Security &amp;amp; JWT Authentication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-rest-xml/"&gt;Spring Boot Rest XML example – Web service with XML Response&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-file-upload/"&gt;Spring Boot Multipart File upload example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-pagination-sorting-example/"&gt;Spring Boot Pagination and Sorting example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using other databases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.bezkoder.com/spring-boot-jpa-h2-example/"&gt;Spring JPA + H2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-postgresql-example/"&gt;Spring JPA + PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jpa-crud-rest-api/"&gt;Spring JPA + MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-mongodb-crud/"&gt;Spring Data + MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>springboot</category>
      <category>java</category>
      <category>todayilearned</category>
      <category>webdev</category>
    </item>
    <item>
      <title>@RestControllerAdvice Annotation in Spring</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Thu, 15 Apr 2021 13:38:30 +0000</pubDate>
      <link>https://dev.to/bezkoder/restcontrolleradvice-annotation-example-b15</link>
      <guid>https://dev.to/bezkoder/restcontrolleradvice-annotation-example-b15</guid>
      <description>&lt;p&gt;In this tutorial, we're gonna look at an Spring Boot exception handling example that uses &lt;code&gt;@RestControllerAdvice&lt;/code&gt; annotation. I also show you the comparison between &lt;code&gt;@RestControllerAdvice&lt;/code&gt; and &lt;code&gt;@ControllerAdvice&lt;/code&gt; along with the use of &lt;code&gt;@ExceptionHandler&lt;/code&gt; annotation.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/spring-boot-restcontrolleradvice/"&gt;https://bezkoder.com/spring-boot-restcontrolleradvice/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Rest API exception handling&lt;/h2&gt;

&lt;p&gt;We've created Rest Controller for CRUD Operations and finder method.&lt;br&gt;
Let look at the code:&lt;br&gt;
(step by step to build the Rest APIs is in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jpa-h2-example/"&gt;Spring Boot Data JPA + H2 CRUD example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jpa-crud-rest-api/"&gt;Spring Boot Data JPA + MySQL CRUD example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-postgresql-example/"&gt;Spring Boot Data JPA + PostgreSQL CRUD example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-mongodb-crud/"&gt;Spring Boot MongoDB CRUD example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://bezkoder.com/spring-boot-cassandra-crud/"&gt;Spring Boot Cassandra CRUD example&lt;/a&gt;)
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@RestController&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TutorialController&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

  &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
  &lt;span class="nc"&gt;TutorialRepository&lt;/span&gt; &lt;span class="n"&gt;tutorialRepository&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

  &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/tutorials"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getAllTutorials&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestParam&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;required&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="o"&gt;...&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;tutorials&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;OK&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;INTERNAL_SERVER_ERROR&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/tutorials/{id}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getTutorialById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@PathVariable&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Optional&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;tutorialData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tutorialRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tutorialData&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isPresent&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;tutorialData&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;OK&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@PutMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/tutorials/{id}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;updateTutorial&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@PathVariable&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nd"&gt;@RequestBody&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt; &lt;span class="n"&gt;tutorial&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Optional&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;tutorialData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tutorialRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tutorialData&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isPresent&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="o"&gt;...&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;tutorialRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_tutorial&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;OK&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="o"&gt;...&lt;/span&gt;

  &lt;span class="nd"&gt;@DeleteMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/tutorials/{id}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;deleteTutorial&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@PathVariable&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;tutorialRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;deleteById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NO_CONTENT&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&amp;gt;(&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;INTERNAL_SERVER_ERROR&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@DeleteMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/tutorials"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;deleteAllTutorials&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// try and catch&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/tutorials/published"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;findByPublished&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// try and catch&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can see that we use try/catch many times for similar exception (&lt;strong&gt;INTERNAL_SERVER_ERROR&lt;/strong&gt;), and there are also many cases that return &lt;strong&gt;NOT_FOUND&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Is there any way to keep them simple, any way to attach the error response message smartly and flexibility?&lt;br&gt;
Let's solve the problem now.&lt;/p&gt;

&lt;h2&gt;@RestControllerAdvice annotation&lt;/h2&gt;

&lt;p&gt;Spring supports exception handling by a global Exception Handler (&lt;a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/ExceptionHandler.html"&gt;@ExceptionHandler&lt;/a&gt;) with Controller Advice (&lt;a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/RestControllerAdvice.html"&gt;@RestControllerAdvice&lt;/a&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@RestControllerAdvice&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ControllerExceptionHandler&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

  &lt;span class="nd"&gt;@ExceptionHandler&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;ResourceNotFoundException&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;CertainException&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
  &lt;span class="nd"&gt;@ResponseStatus&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="nf"&gt;resourceNotFoundException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResourceNotFoundException&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;WebRequest&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getMessage&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt;
        &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;@RestControllerAdvice&lt;/code&gt; annotation is specialization of &lt;code&gt;@Component&lt;/code&gt; annotation so that it is auto-detected via classpath scanning. It is a kind of interceptor that surrounds the logic in our Controllers and allows us to apply some common logic to them. &lt;/p&gt;

&lt;p&gt;Rest Controller Advice's methods (annotated with &lt;code&gt;@ExceptionHandler&lt;/code&gt;) are shared globally across multiple &lt;code&gt;@Controller&lt;/code&gt; components to capture exceptions and translate them to HTTP responses. The &lt;code&gt;@ExceptionHandler&lt;/code&gt; annotation indicates which type of Exception we want to handle. The &lt;code&gt;exception&lt;/code&gt; instance and the &lt;code&gt;request&lt;/code&gt; will be injected via method arguments.&lt;/p&gt;

&lt;p&gt;By using two annotations together, we can:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;control the body of the response along with status code&lt;/li&gt;
    &lt;li&gt;handle several exceptions in the same method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How about &lt;code&gt;@ResponseStatus&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;@RestControllerAdvice&lt;/code&gt; annotation tells a controller that the object returned is automatically serialized into JSON and passed it to the &lt;code&gt;HttpResponse&lt;/code&gt; object. You only need to return Java body object instead of &lt;code&gt;ResponseEntity&lt;/code&gt; object. But the status could be always OK (200) although the data corresponds to exception signal (404 - Not Found for example). &lt;code&gt;@ResponseStatus&lt;/code&gt; can help to set the HTTP status code for the response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@ResponseStatus&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="nf"&gt;resourceNotFoundException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResourceNotFoundException&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;WebRequest&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...    &lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;@RestControllerAdvice with @ResponseEntity&lt;/h2&gt;

&lt;p&gt;If you use &lt;code&gt;@RestControllerAdvice&lt;/code&gt; without &lt;code&gt;@ResponseBody&lt;/code&gt; and &lt;code&gt;@ResponseStatus&lt;/code&gt;, you can return &lt;code&gt;ResponseEntity&lt;/code&gt; object instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@RestControllerAdvice&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ControllerExceptionHandler&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

  &lt;span class="nd"&gt;@ExceptionHandler&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResourceNotFoundException&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="nd"&gt;@ResponseStatus&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="nf"&gt;resourceNotFoundException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResourceNotFoundException&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;WebRequest&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ErrorMessage&lt;/span&gt;&lt;span class="o"&gt;(...);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;@ControllerAdvice vs @RestControllerAdvice&lt;/h2&gt;

&lt;p&gt;For more details and implementing the example, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-boot-restcontrolleradvice/"&gt;https://bezkoder.com/spring-boot-restcontrolleradvice/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;If you want to add Pagination to this Spring project, you can find the instruction at:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-boot-pagination-filter-jpa-pageable/"&gt;Spring Boot Pagination &amp;amp; Filter example | Spring JPA, Pageable&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To sort/order by multiple fields:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-data-sort-multiple-columns/"&gt;Spring Data JPA Sort/Order by multiple Columns | Spring Boot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or way to write Unit Test for the JPA Repository:&lt;br&gt;
&lt;a href="https://bezkoder.com/spring-boot-unit-test-jpa-repo-datajpatest/"&gt;Spring Boot Unit Test for JPA Repositiory with @DataJpaTest&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More Practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-file-upload/"&gt;Spring Boot Multipart File upload example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jwt-authentication/"&gt;Spring Boot Token based Authentication with Spring Security &amp;amp; JWT&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>spring</category>
      <category>webdev</category>
      <category>todayilearned</category>
      <category>java</category>
    </item>
    <item>
      <title>React Redux CRUD example with axios and Rest API</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Tue, 06 Apr 2021 03:38:40 +0000</pubDate>
      <link>https://dev.to/bezkoder/react-redux-crud-example-with-axios-and-rest-api-23ki</link>
      <guid>https://dev.to/bezkoder/react-redux-crud-example-with-axios-and-rest-api-23ki</guid>
      <description>&lt;p&gt;In this tutorial, I will show you how to build a React Redux CRUD example consume Rest API. You also can display and modify data with Router, Axios &amp;amp; Bootstrap.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/react-redux-crud-example/"&gt;https://bezkoder.com/react-redux-crud-example/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span id="Overview"&gt;Overview of React Redux CRUD example&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;We will build a React Redux Tutorial Application with Rest API in that:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Each Tutorial has id, title, description, published status.&lt;/li&gt;
    &lt;li&gt;We can create, retrieve, update, delete Tutorials.&lt;/li&gt;
    &lt;li&gt;There is a Search bar for finding Tutorials by title.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are screenshots of our React Redux CRUD Application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an item:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S4rf0Mer--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0d1ibr84417uykqnzn2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S4rf0Mer--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0d1ibr84417uykqnzn2.png" alt="react-redux-crud-example-axios-create-tutorial" width="500" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieve all items:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QSoQliJW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4j3v6ffxou29cozetm6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QSoQliJW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4j3v6ffxou29cozetm6.png" alt="react-redux-crud-example-axios-retrieve-tutorial" width="650" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;strong&gt;Edit&lt;/strong&gt; button to update an item:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jvJzYHSy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjuwkvuksgh5irk7j1b1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jvJzYHSy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjuwkvuksgh5irk7j1b1.png" alt="react-redux-crud-example-axios-retrieve-one-tutorial" width="500" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this Page, you can:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;change status to &lt;strong&gt;Published&lt;/strong&gt; using &lt;strong&gt;Publish&lt;/strong&gt; button&lt;/li&gt;
    &lt;li&gt;delete the item using &lt;strong&gt;Delete&lt;/strong&gt; button&lt;/li&gt;
    &lt;li&gt;update the item details with &lt;strong&gt;Update&lt;/strong&gt; button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SsOiQn4U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u7jepbzxy2n4pdpkijp6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SsOiQn4U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u7jepbzxy2n4pdpkijp6.png" alt="react-redux-crud-example-axios-update-tutorial" width="500" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search Tutorials by title:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T3g2FJRP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52xgi00k6acutfuxh1hq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T3g2FJRP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52xgi00k6acutfuxh1hq.png" alt="react-redux-crud-example-axios-search-tutorial" width="700" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redux Store:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rugu47IE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t05ghtj2lmxobsx9xuw8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rugu47IE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t05ghtj2lmxobsx9xuw8.png" alt="react-redux-crud-example-axios-store" width="500" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This React Client consumes the following Web API:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;/api/tutorials&lt;/td&gt;
&lt;td&gt;create new Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials&lt;/td&gt;
&lt;td&gt;retrieve all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;retrieve a Tutorial by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;update a Tutorial by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/tutorials/:id&lt;/td&gt;
&lt;td&gt;delete a Tutorial by &lt;code&gt;:id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;/api/tutorials&lt;/td&gt;
&lt;td&gt;delete all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/api/tutorials?title=[keyword]&lt;/td&gt;
&lt;td&gt;find all Tutorials which title contains &lt;code&gt;keyword&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can find step by step to build a Server like this in one of these posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-express-sequelize-mysql/"&gt;Express, Sequelize &amp;amp; MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-express-sequelize-postgresql/"&gt;Express, Sequelize &amp;amp; PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-express-mongodb-crud-rest-api/"&gt;Express &amp;amp; MongoDb&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jpa-crud-rest-api"&gt;Spring Boot &amp;amp; MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-postgresql-example/"&gt;Spring Boot &amp;amp; PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-spring-boot-mongodb/"&gt;Spring Boot &amp;amp; MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jpa-h2-example/"&gt;Spring Boot &amp;amp; H2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-cassandra-crud/"&gt;Spring Boot &amp;amp; Cassandra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/django-crud-mysql-rest-framework/"&gt;Django &amp;amp; MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/django-postgresql-crud-rest-framework/"&gt;Django &amp;amp; PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/django-mongodb-crud-rest-framework/"&gt;Django &amp;amp; MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;span id="Component_Diagram"&gt;React Redux App Component Diagram with Router &amp;amp; Axios&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Now look at the React components that we're gonna implement:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qxkO8STo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/347v4as5airgacynblnr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qxkO8STo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/347v4as5airgacynblnr.png" alt="react-redux-crud-example-axios-components" width="690" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– The &lt;code&gt;App&lt;/code&gt; component is a container with React &lt;code&gt;Router&lt;/code&gt;. It has &lt;code&gt;navbar&lt;/code&gt; that links to routes paths.&lt;/p&gt;

&lt;p&gt;– Three components that dispatch &lt;strong&gt;&lt;em&gt;actions&lt;/em&gt;&lt;/strong&gt; to &lt;code&gt;Redux Thunk Middleware&lt;/code&gt; which uses &lt;code&gt;TutorialDataService&lt;/code&gt; to call Rest API.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;
&lt;code&gt;TutorialsList&lt;/code&gt; component gets and displays Tutorials.&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;Tutorial&lt;/code&gt; component has form for editing Tutorial's details based on &lt;code&gt;:id&lt;/code&gt;.&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;AddTutorial&lt;/code&gt; component has form for submission new Tutorial.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;– &lt;code&gt;TutorialDataService&lt;/code&gt; uses &lt;code&gt;axios&lt;/code&gt; to make HTTP requests and receive responses.&lt;/p&gt;

&lt;h2&gt;&lt;span id="React_Redux_API"&gt;React Redux with API Calls example&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;This diagram shows how Redux elements work in our React Application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HjomsRnz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mim8fo3rugnupw8p6l4o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HjomsRnz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mim8fo3rugnupw8p6l4o.png" alt="react-redux-crud-example-axios-redux-store-architecture" width="650" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're gonna create Redux &lt;code&gt;store&lt;/code&gt; for storing &lt;code&gt;tutorials&lt;/code&gt; data. Other React Components will work with the Store via dispatching an &lt;code&gt;action&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;reducer&lt;/code&gt; will take the action and return new &lt;code&gt;state&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;&lt;span id="Technology"&gt;Technology&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt;React 17/16&lt;/li&gt;
    &lt;li&gt;react-redux 7.2.3&lt;/li&gt;
    &lt;li&gt;redux 4.0.5&lt;/li&gt;
    &lt;li&gt;redux-thunk 2.3.0&lt;/li&gt;
    &lt;li&gt;react-router-dom 5.2.0&lt;/li&gt;
    &lt;li&gt;axios 0.21.1&lt;/li&gt;
    &lt;li&gt;bootstrap 4&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;span id="Project_Structure"&gt;Project Structure&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RxNEychU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6lctzp43sin5vhytn5g3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RxNEychU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6lctzp43sin5vhytn5g3.png" alt="react-redux-crud-example-axios-project-structure" width="280" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm gonna explain it briefly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;package.json&lt;/strong&gt; contains main modules: &lt;code&gt;react&lt;/code&gt;, &lt;code&gt;react-router-dom&lt;/code&gt;, &lt;code&gt;react-redux&lt;/code&gt;, &lt;code&gt;redux&lt;/code&gt;, &lt;code&gt;redux-thunk&lt;/code&gt;, &lt;code&gt;axios&lt;/code&gt; &amp;amp; &lt;code&gt;bootstrap&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;App&lt;/code&gt; is the container that has &lt;code&gt;Router&lt;/code&gt; &amp;amp; navbar.&lt;/li&gt;
&lt;li&gt;There are 3 components: &lt;code&gt;TutorialsList&lt;/code&gt;, &lt;code&gt;Tutorial&lt;/code&gt;, &lt;code&gt;AddTutorial&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;http-common.js&lt;/strong&gt; initializes axios with HTTP base Url and headers.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TutorialDataService&lt;/code&gt; has methods for sending HTTP requests to the Apis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.env&lt;/strong&gt; configures &lt;em&gt;port&lt;/em&gt; for this React CRUD App.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;About Redux elements that we're gonna use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;actions&lt;/strong&gt; folder contains the action creator (&lt;em&gt;tutorials.js&lt;/em&gt; for CRUD operations and searching).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;reducers&lt;/strong&gt; folder contains the reducer (&lt;em&gt;tutorials.js&lt;/em&gt;) which updates the application state corresponding to dispatched action.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More steps and Github source code at:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-redux-crud-example/"&gt;https://bezkoder.com/react-redux-crud-example/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or you can add Pagination Component:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-pagination-material-ui/"&gt;React Pagination with API using Material-UI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nqMg_kuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/77jkvh5e46kozk9agt1l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nqMg_kuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/77jkvh5e46kozk9agt1l.png" alt="react-redux-crud-example-axios-pagination" width="750" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Further Reading
&lt;/h1&gt;

&lt;p&gt;Related Posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-file-upload-axios/"&gt;React File Upload with Axios and Progress Bar to Rest API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-redux-jwt-auth/"&gt;React Redux: JWT Authentication example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Serverless:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firebase-crud/"&gt;React Firebase CRUD with Realtime Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firestore-crud/"&gt;React Firestore CRUD App example | Firebase Cloud Firestore&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React Table Pagination (Server side) with Search | react-table v7</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Sun, 04 Apr 2021 04:11:35 +0000</pubDate>
      <link>https://dev.to/bezkoder/react-table-pagination-server-side-with-search-react-table-v7-39g4</link>
      <guid>https://dev.to/bezkoder/react-table-pagination-server-side-with-search-react-table-v7-39g4</guid>
      <description>&lt;p&gt;In this tutorial, I will show you how to make React Table Pagination (Server side) with Search in a React Hooks Application using react-table v7 for data table and Material-UI for pagination.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/react-table-pagination-server-side/"&gt;https://bezkoder.com/react-table-pagination-server-side/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;React Table Pagination (Server side) with Search example&lt;/h2&gt;

&lt;p&gt;One of the most important things to make a website friendly is the response time, and pagination comes for this reason. For example, this bezkoder.com website has hundreds of tutorials, and we don’t want to see all of them at once. Paging means displaying a small number of all, by a page.&lt;/p&gt;

&lt;p&gt;Assume that we have tutorials table in database like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IM7Rx0gd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vphpdxd3l2kore8wvv5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IM7Rx0gd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vphpdxd3l2kore8wvv5o.png" alt="Alt Text" width="362" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our React.js app will display the result with react-table pagination (server side):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wNVrEqwr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1qv3s5wxzdzhcmqt3a4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wNVrEqwr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1qv3s5wxzdzhcmqt3a4a.png" alt="Alt Text" width="740" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change to a page with larger index:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YL-S4ezX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ln8jlpgwoygv1meqi49v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YL-S4ezX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ln8jlpgwoygv1meqi49v.png" alt="Alt Text" width="730" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can change quantity of items per page (page size):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2ivwNbUH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgyke4i58qm8ypukhw0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ivwNbUH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgyke4i58qm8ypukhw0r.png" alt="Alt Text" width="740" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or table pagination with search:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tQ5aDY2R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmumh0elyvmd9b4sykut.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tQ5aDY2R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmumh0elyvmd9b4sykut.png" alt="Alt Text" width="740" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The API for this React client can be found at one of following posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-sequelize-pagination-mysql/"&gt;Node.js Express Pagination with MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-pagination-postgresql/"&gt;Node.js Express Pagination with PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-mongodb-pagination/"&gt;Node.js Express Pagination with MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-pagination-filter-jpa-pageable/"&gt;Spring Boot Pagination &amp;amp; Filter example | Spring JPA, Pageable&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-mongodb-pagination/"&gt;Spring Boot MongoDB Pagination example with Spring Data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These Servers will exports API for pagination (with/without filter), here are some url samples:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;code&gt;/api/tutorials?page=1&amp;amp;size=5&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;/api/tutorials?size=5&lt;/code&gt;: using default value for page&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;/api/tutorials?page=1&lt;/code&gt;: using default value for size&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;/api/tutorials?title=data&amp;amp;page=1&amp;amp;size=3&lt;/code&gt;: pagination &amp;amp; filter by title containing 'data'&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is structure of the response for the HTTP GET request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"totalItems"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"tutorials"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"totalPages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"currentPage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We actually only need to use &lt;code&gt;tutorials&lt;/code&gt; and &lt;code&gt;totalPages&lt;/code&gt; when working with Material-UI.&lt;/p&gt;

&lt;p&gt;For step by step and Github source code, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-table-pagination-server-side/"&gt;https://bezkoder.com/react-table-pagination-server-side/&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Further Reading
&lt;/h1&gt;

&lt;p&gt;Related Posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-table-example-hooks-crud/"&gt;React Table example: CRUD App | react-table 7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-hooks-jwt-auth/"&gt;React Hooks: JWT Authentication (without Redux) example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-hooks-redux-login-registration-example/"&gt;React Hooks + Redux: JWT Authentication example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-hooks-file-upload/"&gt;React Hooks File Upload example with Axios &amp;amp; Progress Bar&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Serverless with Firebase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firebase-hooks-crud/"&gt;React Hooks + Firebase Realtime Database: CRUD App&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-hooks-firestore/"&gt;React Hooks + Firestore example: CRUD app&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Vue.js Firestore CRUD App example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Sat, 06 Mar 2021 04:46:16 +0000</pubDate>
      <link>https://dev.to/bezkoder/vue-js-firestore-crud-app-example-4hjh</link>
      <guid>https://dev.to/bezkoder/vue-js-firestore-crud-app-example-4hjh</guid>
      <description>&lt;p&gt;In this tutorial, I will show you step by step to build a Vue.js Firetore CRUD App example.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/vue-firestore-crud/"&gt;https://bezkoder.com/vue-firestore-crud/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Vue Firestore CRUD Overview&lt;/h2&gt;

&lt;p&gt;We're gonna build an Vue Firestore CRUD App using &lt;a href="https://www.npmjs.com/package/firebase"&gt;firebase&lt;/a&gt; library in which:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Each Tutorial has key, title, description, published status.&lt;/li&gt;
    &lt;li&gt;We can create, retrieve, update, delete Tutorials (CRUD operations) from Firebase Firestore&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are the screenshots:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new Tutorial:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QVDi9XrF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csg5e691cxqwre92a4ml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QVDi9XrF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csg5e691cxqwre92a4ml.png" alt="vuejs-firestore-crud-app-create" width="700" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cloud Firestore after the Create Operations:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NAuF3abv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tn30vsv9728ri5p6jwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NAuF3abv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tn30vsv9728ri5p6jwb.png" alt="vuejs-firestore-crud-app-cloud-firestore-data-view" width="700" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Retrieve all Tutorials, the details will show when clicking on any Tutorial:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GYHwuE83--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22pdrjahud8yhd6cle7r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GYHwuE83--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22pdrjahud8yhd6cle7r.png" alt="vuejs-firestore-crud-app-retrieve" width="700" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change status to &lt;strong&gt;Published&lt;/strong&gt;/&lt;strong&gt;Pending&lt;/strong&gt; using &lt;strong&gt;Publish&lt;/strong&gt;/&lt;strong&gt;UnPublish&lt;/strong&gt; button:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cdQVehFv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dy14lb52dofr92o7vu4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cdQVehFv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dy14lb52dofr92o7vu4p.png" alt="vuejs-firestore-crud-app-update-status" width="700" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update the Tutorial details with &lt;strong&gt;Update&lt;/strong&gt; button:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ai9ETBS0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvgc2pq3a02s3nab2f13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ai9ETBS0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvgc2pq3a02s3nab2f13.png" alt="vuejs-firestore-crud-app-update" width="700" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete the Tutorial using &lt;strong&gt;Delete&lt;/strong&gt; button:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1cUcrW_y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1nm6hlo4idsyrjqh4jb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1cUcrW_y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1nm6hlo4idsyrjqh4jb0.png" alt="vuejs-firestore-crud-app-delete" width="820" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Vue.js Firestore CRUD Project Structure
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OkUKzWUm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w5qrllxfgjkkc28gnus8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OkUKzWUm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w5qrllxfgjkkc28gnus8.png" alt="vuejs-firestore-crud-app-project-structure" width="270" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain it briefly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;package.json&lt;/strong&gt; contains 3 main modules: &lt;code&gt;vue&lt;/code&gt;, &lt;code&gt;vue-router&lt;/code&gt;, &lt;code&gt;firebase&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;firebase.js&lt;/code&gt; configures information to connect with Firebase Project and export Firebase &lt;a href="https://firebase.google.com/docs/reference/js/firebase.firestore.Firestore"&gt;Firestore&lt;/a&gt; service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TutorialDataService&lt;/code&gt; exports &lt;code&gt;TutorialDataService&lt;/code&gt; that uses &lt;code&gt;firebase&lt;/code&gt;'s Firestore &lt;code&gt;CollectionReference&lt;/code&gt; to interact with Firestore collection.&lt;/li&gt;
&lt;li&gt;There are 3 components that uses &lt;code&gt;TutorialDataService&lt;/code&gt;:
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;AddTutorial&lt;/code&gt; for creating new item&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TutorialsList&lt;/code&gt; contains list of items, parent of &lt;code&gt;Tutorial&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Tutorial&lt;/code&gt; shows item details&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;router.js&lt;/strong&gt; defines routes for components.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;App.Vue&lt;/code&gt; contains Router View and navigation bar.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more details, implementation and Github, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/vue-firestore-crud/"&gt;https://bezkoder.com/vue-firestore-crud/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;Related Posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/vue-firebase-realtime-database/"&gt;Vue Firebase Realtime Database: CRUD example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/vue-js-crud-app/"&gt;Vue.js 2 CRUD Application with Vue Router &amp;amp; Axios&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/vuetify-data-table-example/"&gt;Vuetify data-table example with a CRUD App | v-data-table&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fullstack CRUD App:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/vue-js-node-js-express-mysql-crud-example/"&gt;Vue.js + Node.js + Express + MySQL&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/vue-node-express-postgresql/"&gt;Vue.js + Node.js + Express + PostgreSQL&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/vue-node-express-mongodb-mevn-crud/"&gt;Vue.js + Node.js + Express + MongoDB&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-vue-js-crud-example/"&gt;Vue.js + Spring Boot + MySQL/PostgreSQL&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-vue-mongodb/"&gt;Vue.js + Spring Boot + MongoDB&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/django-vue-js-rest-framework/"&gt;Vue.js + Django Rest Framework&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vue</category>
      <category>firebase</category>
      <category>firestore</category>
      <category>webdev</category>
    </item>
    <item>
      <title>ReactJs JWT Authentication example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Sun, 10 Jan 2021 02:27:08 +0000</pubDate>
      <link>https://dev.to/bezkoder/reactjs-jwt-authentication-example-1a92</link>
      <guid>https://dev.to/bezkoder/reactjs-jwt-authentication-example-1a92</guid>
      <description>&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/react-jwt-auth/"&gt;https://bezkoder.com/react-jwt-auth/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, we're gonna build a Reactjs JWT Token Authentication: Login and Registration example (with Authorization) using LocalStorage, React Router, Axios and Bootstrap (without Redux). I will show you:&lt;/p&gt;

&lt;ul&gt;
        &lt;li&gt;JWT Authentication Flow for User Signup &amp;amp; User Login&lt;/li&gt;
        &lt;li&gt;Project Structure for React JWT Authentication (without Redux) with LocalStorage, React Router &amp;amp; Axios&lt;/li&gt;
    &lt;li&gt;Creating React Components with Form Validation&lt;/li&gt;
    &lt;li&gt;React Components for accessing protected Resources (Authorization)&lt;/li&gt;
    &lt;li&gt;Dynamic Navigation Bar in React App&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The tutorial is for learning purpose. Better practice is to store JWT in HttpOnly cookie:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/react-login-example-jwt-hooks/"&gt;React.js Login &amp;amp; Registration example – JWT &amp;amp; HttpOnly Cookie&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or using Redux for state management:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/redux-toolkit-auth/"&gt;React Redux: JWT Authentication &amp;amp; Authorization example&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Overview of ReactJs JWT Authentication example
&lt;/h2&gt;

&lt;p&gt;We will build a React application in that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are Login/Logout, Signup pages.&lt;/li&gt;
&lt;li&gt;Form data will be validated by front-end before being sent to back-end.&lt;/li&gt;
&lt;li&gt;Depending on User’s roles (admin, moderator, user), Navigation Bar changes its items automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are the screenshots:&lt;br&gt;
– Signup Page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qTGuJPYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qi9jnomvx8rhtpcwxn2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qTGuJPYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qi9jnomvx8rhtpcwxn2c.png" alt="reactjs-jwt-authentication-token-example-signup" width="550" height="1070"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Signup failed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QBmoUUV_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/29glpi1hkkjha9r1k3f0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QBmoUUV_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/29glpi1hkkjha9r1k3f0.png" alt="reactjs-jwt-authentication-token-example-signup-email-duplicate" width="550" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Form Validation Support:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lwU3knz6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2mqrlvr0mefez74ggts3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lwU3knz6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2mqrlvr0mefez74ggts3.png" alt="reactjs-jwt-authentication-token-example-form-validation" width="550" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Login Page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xPwbI6Wh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zdya3j6wofa1p6p04su2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xPwbI6Wh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zdya3j6wofa1p6p04su2.png" alt="reactjs-jwt-authentication-token-example-login" width="570" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Profile Page (for successful Login):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p0fRYDf9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/df5v88t9pimjv1vss9g2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p0fRYDf9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/df5v88t9pimjv1vss9g2.png" alt="reactjs-jwt-authentication-token-example-profile-page" width="570" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– For Moderator account login, the navigation bar will change by authorities:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9ky0LKOq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cny05u9va48oaeomy662.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9ky0LKOq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cny05u9va48oaeomy662.png" alt="reactjs-jwt-authentication-token-example-authorization-login" width="576" height="1120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Check Browser Local Storage:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o6BFcWy_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ftb9bzu540ukjhdg3y2k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o6BFcWy_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ftb9bzu540ukjhdg3y2k.png" alt="react-redux-jwt-authentication-token-example-local-storage" width="700" height="380"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  User Registration and User Login Flow
&lt;/h2&gt;

&lt;p&gt;For JWT Authentication, we’re gonna call 2 endpoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;POST &lt;code&gt;api/auth/signup&lt;/code&gt; for User Registration&lt;/li&gt;
&lt;li&gt;POST &lt;code&gt;api/auth/signin&lt;/code&gt; for User Login&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following flow shows you an overview of Requests and Responses that React Client will make or receive. This React Client must add a JWT to HTTP Header before sending request to protected resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pwW3vLlW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gqmaudsppx48t7zdv16h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pwW3vLlW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gqmaudsppx48t7zdv16h.png" alt="reactjs-jwt-authentication-token-example-flow" width="700" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find step by step to implement these back-end servers in following tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jwt-authentication/"&gt;Spring Boot JWT Authentication with Spring Security, MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-security-postgresql-jwt-authentication/"&gt;Spring Boot JWT Authentication with Spring Security, PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-jwt-auth-mongodb/"&gt;Spring Boot JWT Authentication with Spring Security, MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-jwt-authentication-mysql/"&gt;Node.js JWT Authentication &amp;amp; Authorization with MySQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-mongodb-auth-jwt/"&gt;Node.js JWT Authentication &amp;amp; Authorization with MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-jwt-authentication-postgresql/"&gt;Node.js JWT Authentication &amp;amp; Authorization with PostgreSQL&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Demo Video
&lt;/h2&gt;

&lt;p&gt;This is full React + Node.js Express JWT Authentication &amp;amp; Authorization demo (with form validation, check signup username/email duplicates, test authorization with 3 roles: Admin, Moderator, User):&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/tNcWX9qPcCM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Or React + Spring Boot JWT Authentication &amp;amp; Authorization demo:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/CsgtYvlR7xk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;&lt;span id="React_Component_Diagram"&gt;ReactJs JWT Authentication Component Diagram&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Let's look at the diagram below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yskSDpla--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/snnsy7olf6kir3gc313m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yskSDpla--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/snnsy7olf6kir3gc313m.png" alt="reactjs-jwt-authentication-token-example-components" width="700" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;App&lt;/code&gt; component is a container with React Router (&lt;code&gt;BrowserRouter&lt;/code&gt;). Basing on the state, the navbar can display its items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Login&lt;/code&gt; &amp;amp; &lt;code&gt;Register&lt;/code&gt; components have form for data submission (with support of &lt;code&gt;react-validation&lt;/code&gt; library). They call methods from &lt;code&gt;auth.service&lt;/code&gt; to make login/register request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;auth.service&lt;/code&gt; methods use &lt;code&gt;axios&lt;/code&gt; to make HTTP requests. Its also store or get &lt;strong&gt;JWT&lt;/strong&gt; from Browser Local Storage inside these methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Home&lt;/code&gt; component is public for all visitor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Profile&lt;/code&gt; component displays user information after the login action is successful.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;BoardUser&lt;/code&gt;, &lt;code&gt;BoardModerator&lt;/code&gt;, &lt;code&gt;BoardAdmin&lt;/code&gt; components will be displayed by state &lt;code&gt;user.roles&lt;/code&gt;. In these components, we use &lt;code&gt;user.service&lt;/code&gt; to access protected resources from Web API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;user.service&lt;/code&gt; uses &lt;code&gt;auth-header()&lt;/code&gt; helper function to add JWT to HTTP header. &lt;code&gt;auth-header()&lt;/code&gt; returns an object containing the JWT of the currently logged in user from Local Storage.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;span id="Project_Structure"&gt;Project Structure&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;This is folders &amp;amp; files structure for this React application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a14KmLpO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ew8zygr6u3ygs77d38al.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a14KmLpO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ew8zygr6u3ygs77d38al.png" alt="reactjs-jwt-authentication-token-example-project-structure" width="275" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more details, implementation and Github, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-jwt-auth/"&gt;https://bezkoder.com/react-jwt-auth/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The tutorial is for learning purpose. Better practice is to store JWT in HttpOnly cookie:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/react-login-example-jwt-hooks/"&gt;React.js Login &amp;amp; Registration example – JWT &amp;amp; HttpOnly Cookie&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or using Redux for state management:&lt;br&gt;
&lt;a href="https://www.bezkoder.com/redux-toolkit-auth/"&gt;React Redux: JWT Authentication &amp;amp; Authorization example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>jwt</category>
      <category>todayisearched</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Angular 10 upload file/image to Node.js Express server example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Fri, 08 Jan 2021 10:00:25 +0000</pubDate>
      <link>https://dev.to/bezkoder/angular-10-upload-file-image-to-node-js-example-4cbd</link>
      <guid>https://dev.to/bezkoder/angular-10-upload-file-image-to-node-js-example-4cbd</guid>
      <description>&lt;p&gt;In this tutorial, I will show you way to build Angular 10 with Node.js Express: File/Image upload &amp;amp; download example.&lt;/p&gt;

&lt;p&gt;Original Post: &lt;a href="https://bezkoder.com/angular-10-node-js-file-upload/"&gt;https://bezkoder.com/angular-10-node-js-file-upload/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Newer version with Angular 11:&lt;br&gt;
&lt;a href="https://bezkoder.com/angular-11-node-js-file-upload/"&gt;https://bezkoder.com/angular-11-node-js-file-upload/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Overview&lt;/h2&gt;

&lt;p&gt;We're gonna create a full-stack Angular 10 + Node.js: File/Image upload with Express Rest APIs, in that user can:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;see the upload process (percentage)&lt;/li&gt;
    &lt;li&gt;view all uploaded files/images&lt;/li&gt;
    &lt;li&gt;download by clicking on the file name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0E-mN8L1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4jroudbs2l0chvpo4sp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0E-mN8L1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4jroudbs2l0chvpo4sp1.png" alt="Alt Text" width="620" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All uploaded files will be saved in &lt;strong&gt;uploads&lt;/strong&gt; folder:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--utgU5gjP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fxa72hsfcsdmk0ztdypz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--utgU5gjP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fxa72hsfcsdmk0ztdypz.png" alt="Alt Text" width="260" height="92"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to upload multiple files/images at once like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AvsOuvZU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f3qhqruxp9m19dcwepnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AvsOuvZU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f3qhqruxp9m19dcwepnc.png" alt="Alt Text" width="620" height="840"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the instruction here:&lt;br&gt;
&lt;a href="https://bezkoder.com/angular-10-upload-multiple-images/"&gt;Angular 10 upload Multiple Images example&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Technology&lt;/h2&gt;

&lt;p&gt;Server:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;express 4.17.1&lt;/li&gt;
    &lt;li&gt;multer 1.4.2&lt;/li&gt;
    &lt;li&gt;cors 2.8.5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Client:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Angular 10&lt;/li&gt;
    &lt;li&gt;RxJS 6&lt;/li&gt;
    &lt;li&gt;Bootstrap 4&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Node.js Express Rest APIs for File Upload &amp;amp; Storage&lt;/h2&gt;

&lt;p&gt;Node.js Server will provide APIs:&lt;/p&gt;


&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;/upload&lt;/td&gt;
&lt;td&gt;upload a File&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/files&lt;/td&gt;
&lt;td&gt;get List of Files (name &amp;amp; url)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/files/[filename]&lt;/td&gt;
&lt;td&gt;download a File&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;p&gt;This is the project structure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RMxEuCpf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2021/01/angular-10-node-js-file-upload-example-express-server-project-structure.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RMxEuCpf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2021/01/angular-10-node-js-file-upload-example-express-server-project-structure.png" alt="angular-10-node-js-file-upload-example-express-server-project-structure" width="280" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;resources/static/assets/uploads&lt;/code&gt;: folder for storing uploaded files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;middleware/upload.js&lt;/code&gt;: initializes Multer Storage engine and defines middleware function to save uploaded files in &lt;code&gt;uploads&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;file.controller.js&lt;/code&gt; exports Rest APIs: POST a file, GET all files' information, download a File with url.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;routes/index.js&lt;/code&gt;: defines routes for endpoints that is called from HTTP Client, use controller to handle requests.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;server.js&lt;/code&gt;: initializes routes, runs Express app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find Step by Step to implement the Node.js Express Server (with Github) at:&lt;br&gt;
&lt;a href="https://bezkoder.com/node-js-express-file-upload/"&gt;Node.js Express File Upload Rest API example using Multer&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Angular 10 Client for file upload/download UI&lt;/h2&gt;

&lt;p&gt;This is the project structure that we're gonna build:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yAmUoeiv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jas0zg6rts8w8zp3fhmu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yAmUoeiv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jas0zg6rts8w8zp3fhmu.png" alt="Alt Text" width="270" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We import necessary library, components in &lt;em&gt;app.module.ts&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;upload-file.service&lt;/em&gt; provides methods to save File and get Files from Spring Boot Server.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;upload-files.component&lt;/em&gt; contains upload form, progress bar, display of list files.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;app.component&lt;/em&gt; is the container that we embed all components.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;index.html&lt;/em&gt; for importing the Bootstrap.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Angular Service for File Upload&lt;/strong&gt;&lt;br&gt;
This service will use Angular &lt;code&gt;HTTPClient&lt;/code&gt; to send HTTP requests.&lt;br&gt;
There are 2 functions:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;
&lt;code&gt;upload(file)&lt;/code&gt;: returns &lt;code&gt;Observable&amp;lt;HttpEvent&amp;lt;any&amp;gt;&amp;gt;&lt;/code&gt; that we're gonna use for tracking progress&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;getFiles()&lt;/code&gt;: returns a list of Files' information as &lt;code&gt;Observable&lt;/code&gt; object&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;UploadFileService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;HttpClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;File&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;Observable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HttpEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;getFiles&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;Observable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Angular Component for File Upload&lt;/strong&gt;&lt;br&gt;
File Upload Component has Progress Bar, Card, Button and Message. It injects &lt;code&gt;UploadFileService&lt;/code&gt; to call &lt;code&gt;uploadService.upload()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;The upload progress will be calculated basing on &lt;code&gt;event.loaded&lt;/code&gt; and &lt;code&gt;event.total&lt;/code&gt;.&lt;br&gt;
If the transmission is done, the event will be a &lt;code&gt;HttpResponse&lt;/code&gt; object. At this time, we call &lt;code&gt;uploadService.getFiles()&lt;/code&gt; to get the files' information and assign the result to &lt;code&gt;fileInfos&lt;/code&gt; variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;selectedFiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;uploadService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentFile&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;HttpEventType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;UploadProgress&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loaded&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;HttpResponse&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fileInfos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;uploadService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getFiles&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Could not upload the file!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more details, implementation and Github, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/angular-10-node-js-file-upload/"&gt;https://bezkoder.com/angular-10-node-js-file-upload/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Run the App&lt;/h2&gt;

&lt;p&gt;Run Spring Boot Server with command: &lt;code&gt;mvn spring-boot:run&lt;/code&gt;.&lt;br&gt;
Refresh the project directory and you will see &lt;em&gt;uploads&lt;/em&gt; folder inside it.&lt;/p&gt;

&lt;p&gt;Because we configure CORS for origin: &lt;code&gt;&lt;a href="http://localhost:8081"&gt;http://localhost:8081&lt;/a&gt;&lt;/code&gt;, so you need to run Angular 10 Client with command:&lt;br&gt;
&lt;code&gt;ng serve --port 8081&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open Browser with url &lt;code&gt;&lt;a href="http://localhost:8081/"&gt;http://localhost:8081/&lt;/a&gt;&lt;/code&gt; and check the result.&lt;/p&gt;

&lt;h2&gt;Further Reading&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="https://angular.io/api/common/http/HttpRequest"&gt;https://angular.io/api/common/http/HttpRequest&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-spring-boot-crud/"&gt;Angular 10 + Spring Boot example: Build a CRUD App&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-spring-boot-jwt-auth/"&gt;Angular 10 + Spring Boot: JWT Authentication example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fullstack CRUD App:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-spring-boot-crud/"&gt;Angular 10 + Spring Boot + MySQL example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-spring-boot-postgresql/"&gt;Angular 10 + Spring Boot + PostgreSQL example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-10-spring-boot-mongodb/"&gt;Angular 10 + Spring Boot + MongoDB example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Serverless with Firebase:&lt;br&gt;
&lt;a href="https://bezkoder.com/firebase-storage-angular-10-file-upload/"&gt;Angular 10 Firebase Storage: File Upload/Display/Delete example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React Multiple Images Upload with Preview example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Wed, 06 Jan 2021 04:19:38 +0000</pubDate>
      <link>https://dev.to/bezkoder/react-multiple-images-upload-with-preview-example-5872</link>
      <guid>https://dev.to/bezkoder/react-multiple-images-upload-with-preview-example-5872</guid>
      <description>&lt;p&gt;In this React tutorial, I will show you way to build React.js Multiple Images upload example with Preview using Axios and Multipart File for making HTTP requests, Bootstrap for progress bar and display list of images' information (with download url).&lt;/p&gt;

&lt;p&gt;Original Full Post: &lt;a href="https://bezkoder.com/react-multiple-image-upload-with-preview/"&gt;https://bezkoder.com/react-multiple-image-upload-with-preview/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;React Multiple Images upload Overview&lt;/h2&gt;

&lt;p&gt;We’re gonna create a React.js Multiple Images Upload with Preview application in that user can:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;see the preview of images that will be uploaded&lt;/li&gt;
    &lt;li&gt;see the upload process (percentage) of each image with progress bars&lt;/li&gt;
    &lt;li&gt;view all uploaded files&lt;/li&gt;
    &lt;li&gt;download link to file when clicking on the file name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are screenshots of our React App:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before upload:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fi65-SLK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6yhe12c5yami892quz82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fi65-SLK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6yhe12c5yami892quz82.png" alt="react-multiple-image-upload-with-preview-before-upload" width="660" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload is done:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--txfoizu1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h8nrrks22e7wtnwgwkpt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--txfoizu1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h8nrrks22e7wtnwgwkpt.png" alt="react-multiple-image-upload-with-preview-example" width="520" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;List of Images Display with download Urls:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n_ViqbVx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m8yznn4bc0i3mip5r4xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n_ViqbVx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m8yznn4bc0i3mip5r4xw.png" alt="react-multiple-image-upload-with-preview-list-images" width="519" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show status for each image upload:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KqlFqxTd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5220cnrw5s914mm9y5az.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KqlFqxTd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5220cnrw5s914mm9y5az.png" alt="react-multiple-image-upload-with-preview-status" width="540" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Web API for Image Upload &amp;amp; Storage&lt;/h2&gt;

&lt;p&gt;Here are APIs that we will use Axios to make HTTP requests:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;/upload&lt;/td&gt;
&lt;td&gt;upload a File&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/files&lt;/td&gt;
&lt;td&gt;get List of Files (name &amp;amp; url)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;/files/[filename]&lt;/td&gt;
&lt;td&gt;download a File&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can find how to implement the Rest APIs Server at one of following posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-express-file-upload/"&gt;Node.js Express File Upload Rest API example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/spring-boot-file-upload/"&gt;Spring Boot Multipart File upload (to static folder) example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Project Structure&lt;/h2&gt;

&lt;p&gt;After building the React project is done, the folder structure will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PRjf4cuY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2021/01/react-js-multiple-image-upload-with-preview-example-project-structure.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PRjf4cuY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2021/01/react-js-multiple-image-upload-with-preview-example-project-structure.png" alt="react-js-multiple-image-upload-with-preview-example-project-structure" width="260" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain it briefly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;file-upload.service&lt;/em&gt; provides methods to save File and get Files using Axios.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;images-upload.component&lt;/em&gt; contains upload form for multiple images, preview, progress bar, list of uploaded images display.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;App.js&lt;/em&gt; is the container that we embed all React components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;http-common.js&lt;/em&gt; initializes Axios with HTTP base Url and headers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We configure port for our App in &lt;em&gt;.env&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more details, implementation and Github, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-multiple-image-upload-with-preview/"&gt;https://bezkoder.com/react-multiple-image-upload-with-preview/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-file-upload-spring-boot/"&gt;React File Upload/Download example with Spring Boot Rest Api&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-crud-web-api/"&gt;React.js CRUD example to consume Web API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-jwt-auth/"&gt;React JWT Authentication &amp;amp; Authorization (without Redux) example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-redux-jwt-auth/"&gt;React Redux: JWT Authentication &amp;amp; Authorization example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>CRUD Operations in React.js and MySQL example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Mon, 04 Jan 2021 14:27:37 +0000</pubDate>
      <link>https://dev.to/bezkoder/crud-operations-in-react-js-and-mysql-example-2bj9</link>
      <guid>https://dev.to/bezkoder/crud-operations-in-react-js-and-mysql-example-2bj9</guid>
      <description>&lt;p&gt;In this tutorial, I will show you how to make CRUD Operation in React.js and MySQL example using Express &amp;amp; Sequelize. The back-end server uses Node.js + Express for REST APIs, front-end side is a React.js client with React Router, Axios &amp;amp; Bootstrap.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/react-node-express-mysql/"&gt;https://bezkoder.com/react-node-express-mysql/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;CRUD Operations with React.js and MySQL Overview&lt;/h2&gt;

&lt;p&gt;We will build a full-stack Tutorial Application in that:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Tutorial has id, title, description, published status.&lt;/li&gt;
    &lt;li&gt;User can create, retrieve, update, delete Tutorials.&lt;/li&gt;
    &lt;li&gt;There is a search box for finding Tutorials by title.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are screenshots of the example.&lt;/p&gt;

&lt;p&gt;– Add an item:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3cgkXQlp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zc6g3fitgkg6qh2gfaih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3cgkXQlp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zc6g3fitgkg6qh2gfaih.png" alt="crud-operations-react-js-mysql-example-create" width="500" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Show all items:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U6w_GZyb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a4v3v130c5tem2sdqf39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U6w_GZyb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a4v3v130c5tem2sdqf39.png" alt="crud-operations-react-js-mysql-example-retrieve-all" width="680" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Click on &lt;strong&gt;Edit&lt;/strong&gt; button to view details of an item:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D3Xnj4f_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m4yhy557f6q2sxm996q8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D3Xnj4f_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m4yhy557f6q2sxm996q8.png" alt="crud-operations-react-js-mysql-example-retrieve" width="480" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this Page, you can:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;change status to &lt;strong&gt;Published&lt;/strong&gt;/&lt;strong&gt;Pending&lt;/strong&gt; using &lt;strong&gt;Publish&lt;/strong&gt;/&lt;strong&gt;UnPublished&lt;/strong&gt; button&lt;/li&gt;
    &lt;li&gt;remove the object from MySQL Database using &lt;strong&gt;Delete&lt;/strong&gt; button&lt;/li&gt;
    &lt;li&gt;update this object's details on Database with &lt;strong&gt;Update&lt;/strong&gt; button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0k1MFO2y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a9srx7h0heriphfsgd4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0k1MFO2y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a9srx7h0heriphfsgd4y.png" alt="crud-operations-react-js-mysql-example-update" width="500" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search objects by field 'title':&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LzEojPQA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f5k4qa9t7wersp6d6phc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LzEojPQA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f5k4qa9t7wersp6d6phc.png" alt="crud-operations-react-js-mysql-example-search" width="688" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check MySQL database:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lCXia-ob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dxrry3qxpzd0e0tue9iu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lCXia-ob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dxrry3qxpzd0e0tue9iu.png" alt="crud-operations-react-js-mysql-example-database" width="700" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;React + Node.js + MySQL Architecture&lt;/h2&gt;

&lt;p&gt;We're gonna build the application with following architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LWXTYx7_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4snwhhwxeaou0bmcv9zf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LWXTYx7_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4snwhhwxeaou0bmcv9zf.png" alt="crud-operations-react-js-mysql-example-architecture" width="700" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Node.js Express exports REST APIs &amp;amp; interacts with MySQL Database using Sequelize ORM.&lt;br&gt;
– React Client sends HTTP Requests and retrieves HTTP Responses using &lt;em&gt;Axios&lt;/em&gt;, consume data on the components. React Router is used for navigating to pages.&lt;/p&gt;

&lt;h2&gt;Video&lt;/h2&gt;

&lt;p&gt;This is our React Node.js Express Sequelize application demo (with brief instruction) running with MySQL database.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/7dZ0GN5FPA8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;Node.js Express Back-end&lt;/h2&gt;

&lt;p&gt;These are APIs that Node.js Express App will export:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;api/tutorials&lt;/td&gt;
&lt;td&gt;get all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;api/tutorials/:id&lt;/td&gt;
&lt;td&gt;get Tutorial by &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;api/tutorials&lt;/td&gt;
&lt;td&gt;add new Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;api/tutorials/:id&lt;/td&gt;
&lt;td&gt;update Tutorial by &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;api/tutorials/:id&lt;/td&gt;
&lt;td&gt;remove Tutorial by &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;api/tutorials&lt;/td&gt;
&lt;td&gt;remove all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;api/tutorials?title=[kw]&lt;/td&gt;
&lt;td&gt;find all Tutorials which title contains &lt;code&gt;'kw'&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;React.js Front-end&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dxM9JWV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p6uvdvnjf7zfhia9wrs2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dxM9JWV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p6uvdvnjf7zfhia9wrs2.png" alt="crud-operations-react-js-mysql-example-client-components" width="680" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– The &lt;code&gt;App&lt;/code&gt; component is a container with React &lt;code&gt;Router&lt;/code&gt;. It has &lt;code&gt;navbar&lt;/code&gt; that links to routes paths.&lt;/p&gt;

&lt;p&gt;– &lt;code&gt;TutorialsList&lt;/code&gt; component gets and displays Tutorials.&lt;br&gt;
– &lt;code&gt;Tutorial&lt;/code&gt; component has form for editing Tutorial's details based on &lt;code&gt;:id&lt;/code&gt;.&lt;br&gt;
– &lt;code&gt;AddTutorial&lt;/code&gt; component has form for submission new Tutorial.&lt;/p&gt;

&lt;p&gt;– These Components call &lt;code&gt;TutorialDataService&lt;/code&gt; methods which use &lt;code&gt;axios&lt;/code&gt; to make HTTP requests and receive responses.&lt;/p&gt;

&lt;p&gt;For more details, implementation and Github, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-node-express-mysql/"&gt;https://bezkoder.com/react-node-express-mysql/&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Further Reading
&lt;/h1&gt;

&lt;p&gt;Run both projects in one place:&lt;br&gt;
&lt;a href="https://bezkoder.com/integrate-react-express-same-server-port/"&gt;How to integrate React with Node.js Express on same Server/Port&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Pagination:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-pagination-material-ui/"&gt;React Pagination with API using Material-UI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ay-rctSj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jmxvrdurwu20bs443504.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ay-rctSj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jmxvrdurwu20bs443504.png" alt="crud-operations-react-js-mysql-example-pagination" width="750" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or Serverless with Firebase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firebase-crud/"&gt;React Firebase CRUD with Realtime Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firestore-crud/"&gt;React Firestore CRUD App example | Firebase Cloud Firestore&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>mysql</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Spring Boot + Angular: Pagination example</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Sun, 03 Jan 2021 07:54:09 +0000</pubDate>
      <link>https://dev.to/bezkoder/spring-boot-angular-pagination-example-13gl</link>
      <guid>https://dev.to/bezkoder/spring-boot-angular-pagination-example-13gl</guid>
      <description>&lt;p&gt;In this tutorial, I will show you how to build a full-stack Pagination (Angular + Spring Boot) example on Server side. The back-end server uses Spring Data and Spring Web for REST APIs, front-end side is an Angular 11/10/8 App with HTTPClient.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/pagination-spring-boot-angular-11/"&gt;https://bezkoder.com/pagination-spring-boot-angular-11/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Pagination with Angular &amp;amp; Spring Boot example&lt;/h2&gt;

&lt;p&gt;Assume that we have tutorials table in database like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1dYgHs2v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-database.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1dYgHs2v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-database.png" alt="spring-boot-angular-11-pagination-example-database" width="551" height="728"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to export APIs for pagination (with/without filter) as following samples:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;code&gt;/api/tutorials?page=1&amp;amp;size=3&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;/api/tutorials?size=5&lt;/code&gt;: using default value for page&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;/api/tutorials?title=data&amp;amp;page=1&amp;amp;size=5&lt;/code&gt;: pagination &amp;amp; filter by title containing 'data'&lt;/li&gt;
    &lt;li&gt;
&lt;code&gt;/api/tutorials/published?page=2&lt;/code&gt;: pagination &amp;amp; filter by 'published' status&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is structure of the result that we want to get from the APIs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"totalItems"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"tutorials"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"totalPages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"currentPage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our Angular app will display the result with pagination:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iLcWcvUT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-default-paging.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iLcWcvUT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-default-paging.png" alt="spring-boot-angular-11-pagination-example-default-paging" width="660" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can change to a page with larger index:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aSJ8YjGO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-change-page.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aSJ8YjGO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-change-page.png" alt="spring-boot-angular-11-pagination-example-change-page" width="660" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or change page size (quantity of items per page):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NnYey9Z9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-change-items-per-page.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NnYey9Z9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-change-items-per-page.png" alt="spring-boot-angular-11-pagination-example-change-items-per-page" width="660" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or paging with filter:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FD5UTMAu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-paging-filter.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FD5UTMAu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-paging-filter.png" alt="spring-boot-angular-11-pagination-example-paging-filter" width="660" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Full-stack Architecture&lt;/h2&gt;

&lt;p&gt;We're gonna build the application with following architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GLX7IsxD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-architecture.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GLX7IsxD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://bezkoder.com/wp-content/uploads/2020/12/spring-boot-angular-11-pagination-example-architecture.png" alt="spring-boot-angular-11-pagination-example-architecture" width="700" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spring Boot exports REST Apis using Spring Web MVC &amp;amp; interacts with Database using Spring Data.&lt;/li&gt;
&lt;li&gt;Angular 11/10/8 Client sends HTTP Requests and retrieve HTTP Responses using &lt;strong&gt;axios&lt;/strong&gt;, shows data on the components. We also use Angular Router for navigating to pages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more details, please visit: &lt;a href="https://bezkoder.com/pagination-spring-boot-angular-11/"&gt;https://bezkoder.com/pagination-spring-boot-angular-11/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/integrate-angular-spring-boot/"&gt;How to Integrate Angular with Spring Boot Rest API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fullstack CRUD App:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-11-spring-boot-crud/"&gt;Angular + Spring Boot + MySQL example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-11-spring-boot-postgresql/"&gt;Angular + Spring Boot + PostgreSQL example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/angular-11-spring-boot-mongodb/"&gt;Angular + Spring Boot + MongoDB example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or Security: &lt;a href="https://bezkoder.com/angular-11-spring-boot-jwt-auth/"&gt;Angular 11 + Spring Boot: JWT Authentication example&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy learning, see you again!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>springboot</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React.js + Node.js + MongoDB CRUD example - MERN stack Application</title>
      <dc:creator>bezkoder</dc:creator>
      <pubDate>Sat, 02 Jan 2021 12:09:30 +0000</pubDate>
      <link>https://dev.to/bezkoder/react-js-node-js-mongodb-crud-example-mern-stack-application-12dd</link>
      <guid>https://dev.to/bezkoder/react-js-node-js-mongodb-crud-example-mern-stack-application-12dd</guid>
      <description>&lt;p&gt;In this tutorial, we're gonna build a MERN stack: React.js + Node.js + MongoDB CRUD Application with Express example. The back-end server uses Node.js + Express for REST APIs, front-end side is a React client with React Router, Axios &amp;amp; Bootstrap.&lt;/p&gt;

&lt;p&gt;Full Article: &lt;a href="https://bezkoder.com/react-node-express-mongodb-mern-stack/"&gt;https://bezkoder.com/react-node-express-mongodb-mern-stack/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;React.js + Node.js + MongoDB CRUD example Overview&lt;/h2&gt;

&lt;p&gt;We will build a full-stack Tutorial Application in that:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Tutorial has id, title, description, published status.&lt;/li&gt;
    &lt;li&gt;User can create, retrieve, update, delete Tutorials.&lt;/li&gt;
    &lt;li&gt;There is a search box for finding Tutorials by title.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;- Add an item:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fi8KN5OJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s98yzx8zyefc14dphj5j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fi8KN5OJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s98yzx8zyefc14dphj5j.png" alt="react-node-js-mongodb-example-crud-mern-stack-create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;- Show all items:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qlj_pgJ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/selmhone4n85xqtqopn3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qlj_pgJ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/selmhone4n85xqtqopn3.png" alt="react-node-js-mongodb-example-crud-mern-stack-retrieve-all"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;– Click on &lt;strong&gt;Edit&lt;/strong&gt; button to view details of an item:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HF9gis_L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/027idmd313soswyrrxqf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HF9gis_L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/027idmd313soswyrrxqf.png" alt="react-node-js-mongodb-example-crud-mern-stack--retrieve"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this Page, you can:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;change status to &lt;strong&gt;Published&lt;/strong&gt;/&lt;strong&gt;Pending&lt;/strong&gt; using &lt;strong&gt;Publish&lt;/strong&gt;/&lt;strong&gt;UnPublished&lt;/strong&gt; button&lt;/li&gt;
    &lt;li&gt;remove the object from MongoDB Database using &lt;strong&gt;Delete&lt;/strong&gt; button&lt;/li&gt;
    &lt;li&gt;update this object's details on Database with &lt;strong&gt;Update&lt;/strong&gt; button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--clCo7RRj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z9ftt59979dnm83sjbk9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--clCo7RRj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z9ftt59979dnm83sjbk9.png" alt="react-node-js-mongodb-example-crud-mern-stack-update"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;- Search items by field 'title':&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5i_L6l7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ojffcxdux31o3k6z8rfk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5i_L6l7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ojffcxdux31o3k6z8rfk.png" alt="react-node-js-mongodb-example-crud-mern-stack-search"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check MongoDB Database:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MoyvOH1U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wzw3liu1bl0knc1tapgi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MoyvOH1U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wzw3liu1bl0knc1tapgi.png" alt="react-node-js-mongodb-example-crud-mern-stack-database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;MERN stack Architecture&lt;/h2&gt;

&lt;p&gt;Our React.js + Node.js + MongoDB CRUD application will follow this architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XXjt4w9z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/frl9aqvko63ziw819w02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XXjt4w9z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/frl9aqvko63ziw819w02.png" alt="react-node-js-mongodb-example-crud-mern-stack-architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js Express exports REST APIs &amp;amp; interacts with MongoDB Database using Mongoose ODM.&lt;/li&gt;
&lt;li&gt;React Client sends HTTP Requests and retrieves HTTP Responses using &lt;em&gt;Axios&lt;/em&gt;, consumes data on the components. React Router is used for navigating to pages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Video&lt;/h2&gt;

&lt;p&gt;This is brief instruction on React Node.js Express application running with MongoDB database.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3um2lqj7FqM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;Node.js Express MongoDB Back-end&lt;/h2&gt;

&lt;p&gt;These are APIs that Node.js Express App will export:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Urls&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;api/tutorials&lt;/td&gt;
&lt;td&gt;get all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;api/tutorials/:id&lt;/td&gt;
&lt;td&gt;get Tutorial by &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;api/tutorials&lt;/td&gt;
&lt;td&gt;add new Tutorial&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;api/tutorials/:id&lt;/td&gt;
&lt;td&gt;update Tutorial by &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;api/tutorials/:id&lt;/td&gt;
&lt;td&gt;remove Tutorial by &lt;code&gt;id&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;api/tutorials&lt;/td&gt;
&lt;td&gt;remove all Tutorials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;api/tutorials?title=[kw]&lt;/td&gt;
&lt;td&gt;find all Tutorials which title contains &lt;code&gt;'kw'&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;React.js Front-end&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jT_p29J1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zvocsrzwif9acscsh9tu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jT_p29J1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zvocsrzwif9acscsh9tu.png" alt="react-node-js-mongodb-example-crud-mern-stack-client-overview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;App&lt;/code&gt; component is a container with React &lt;code&gt;Router&lt;/code&gt;. It has &lt;code&gt;navbar&lt;/code&gt; that links to routes paths.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;TutorialsList&lt;/code&gt; component gets and displays Tutorials.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Tutorial&lt;/code&gt; component has form for editing Tutorial's details based on &lt;code&gt;:id&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;AddTutorial&lt;/code&gt; component has form for submission new Tutorial.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These Components call &lt;code&gt;TutorialDataService&lt;/code&gt; methods which use &lt;code&gt;axios&lt;/code&gt; to make HTTP requests and receive responses.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more details, implementation and Github, please visit:&lt;br&gt;
&lt;a href="https://bezkoder.com/react-node-express-mongodb-mern-stack/"&gt;https://bezkoder.com/react-node-express-mongodb-mern-stack/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;Run both projects in one place:&lt;br&gt;
&lt;a href="https://bezkoder.com/integrate-react-express-same-server-port/"&gt;How to integrate React with Node.js Express on same Server/Port&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Pagination:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-pagination-material-ui/"&gt;React Pagination with API using Material-UI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/node-js-mongodb-pagination/"&gt;Server side Pagination in Node.js, MongoDB | Mongoose Paginate v2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--45kEm7VX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zxnd1ekc9kt6q9clpar8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--45kEm7VX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zxnd1ekc9kt6q9clpar8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Security: &lt;a href="https://bezkoder.com/react-node-mongodb-auth/"&gt;MERN stack Authentication &amp;amp; Authorization&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or Serverless with Firebase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firebase-crud/"&gt;React Firebase CRUD with Realtime Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bezkoder.com/react-firestore-crud/"&gt;React Firestore CRUD App example | Firebase Cloud Firestore&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dockerize: &lt;a href="https://www.bezkoder.com/docker-mern/"&gt;Docker Compose React + Node.js Express + MongoDB example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>node</category>
      <category>mongodb</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
