<?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: Nil Madhab</title>
    <description>The latest articles on DEV Community by Nil Madhab (@nilmadhabmondal).</description>
    <link>https://dev.to/nilmadhabmondal</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%2F550216%2F8c33f5c6-db02-4573-8807-087913986856.jpg</url>
      <title>DEV Community: Nil Madhab</title>
      <link>https://dev.to/nilmadhabmondal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nilmadhabmondal"/>
    <language>en</language>
    <item>
      <title> Build Multiplayer Realtime Tic Tac Toe Game with Socket.io and Vue</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 05 Nov 2021 18:52:46 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/build-multiplayer-realtime-tic-tac-toe-game-with-socketio-and-vue-5clp</link>
      <guid>https://dev.to/nilmadhabmondal/build-multiplayer-realtime-tic-tac-toe-game-with-socketio-and-vue-5clp</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F9446%2F0%2AlSNWNj7XtNjts61u" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F9446%2F0%2AlSNWNj7XtNjts61u" alt="Photo by [Visual Stories || Micheile](https://unsplash.com/@micheile?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, we will develop a tic-tac-toe game from scratch using Vue. We will integrate the real time feature with socket.io, so that two players can play the game from different browsers at the same time. &lt;/p&gt;

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

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

&lt;h2&gt;
  
  
  Project creation
&lt;/h2&gt;

&lt;p&gt;First, create a blank Vue project  and in the app.vue,remove the hello world component and add the html for the grid. I copied the CSS from this &lt;a href="https://dev.to/ayushmanbthakur/how-to-make-tic-tac-toe-in-browser-with-html-css-and-js-28ed"&gt;tutorial&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;We will define 9 blocks with id block_0 to block_8 with class block for each block.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
You will see the result like this. 

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AL7bUoSF9gJXfbfa31ZhfHQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AL7bUoSF9gJXfbfa31ZhfHQ.png" alt="Basic grid implementation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the Github code till now in this branch.&lt;br&gt;
&lt;a href="https://github.com/nilmadhab/tic-tac-toe-youtube/tree/grid-setup" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub - nilmadhab/tic-tac-toe-youtube at grid-setup&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Draw X and O on click
&lt;/h2&gt;

&lt;p&gt;Now, we will define two variables in the data section:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;content&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;turn&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

Content will be an array of length 9, one element for each block of html, initialized with the empty string. When we click one block, we will change the value at that index of the content. Let’s define the function &lt;a class="mentioned-user" href="https://dev.to/click"&gt;@click&lt;/a&gt;, and use it.
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

We will draw the X and O based on the content array and on the click will trigger the draw function in each block.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, let’s define the draw function in the methodsection. If the value of turnis true, we will draw X, else we will draw O and change the value of turn. So, first click we draw X andturn becomes false. So, on the second click, we draw O and turn becomes true and so on..&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AuUMEkDHkuszs9dCgZHAfzQ.png"&gt;
&lt;h2&gt;
  
  
  Calculate Winner
&lt;/h2&gt;

&lt;p&gt;Now, after every call in the draw function, we have to calculate if the game is finished or not. If finished, we can find who is the winner and display it. &lt;/p&gt;

&lt;p&gt;We will declare three variables more in the data section.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
In the template section, we will add two h2 tags to declare the winner or a tie.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Now, we are ready to define calculateWinner function. The logic is if the same row, column or diagonals are occupied by the same player, he/she wins.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
We call this function, every time we draw.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A7TDPy3n98A3AKhzJMv9o8A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A7TDPy3n98A3AKhzJMv9o8A.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Calculate Tie
&lt;/h2&gt;

&lt;p&gt;Now we will define tie function. The logic is even if there is an empty block, the game is not tied.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
We will define this function is method section and call it from draw method.

&lt;p&gt;Entire script section till now.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A0kSWW3YxhywWnNrrm2UpGw.png"&gt;
&lt;h2&gt;
  
  
  Reset Board
&lt;/h2&gt;

&lt;p&gt;Now, when the game is tied or over, we have to show an option to reset the board. &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
We will define the resetBoard function next. We reset the content array and all the other variables.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AHfbOGV1R1gv_8ATCS1ZDxQ.png" alt="reset board"&gt;

&lt;p&gt;Github code till now.&lt;br&gt;
&lt;a href="https://github.com/nilmadhab/tic-tac-toe-youtube/tree/game-logic-implemented" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub - nilmadhab/tic-tac-toe-youtube at game-logic-implemented&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Multiplayer mode Using Socket.io
&lt;/h2&gt;

&lt;p&gt;Now, we will integrate the project with Socket.io, so that two players can play the game at the same time. When one player clicks X, it should appear on the second player’s screen and when the second player clicks O, it should appear on the first player’s screen. How to implement it?&lt;/p&gt;

&lt;p&gt;Here, &lt;a href="https://socket.io/docs/v3/" rel="noopener noreferrer"&gt;socket.IO&lt;/a&gt; comes handy. The documentation says,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2148%2F1%2AsdrbtVfTRyR7C_px0aJlVA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2148%2F1%2AsdrbtVfTRyR7C_px0aJlVA.png" alt="socket.js documentation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to watch the video tutorial, you can download the above branch and fast forward the video to 35:42 mins.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/7eEDH-qQl8Y"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Set up server for socket.io
&lt;/h2&gt;

&lt;p&gt;We will first create a folder outside the Vue project. Create a file server.js inside  the folder. We will create an express server inside the folder. &lt;/p&gt;

&lt;p&gt;Run npm init. It will set apackage.json file.&lt;/p&gt;

&lt;p&gt;Then run&lt;/p&gt;

&lt;p&gt;npm i socket.io&lt;/p&gt;

&lt;p&gt;It will install socket.io in the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  server.js
&lt;/h3&gt;

&lt;p&gt;Now. lets create a server and integrate socket.io.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
We will set cors rule, so that our vue.js project running on port 8080 can access the server.

&lt;p&gt;We will emit an event from the server and our Vue client should listen to it and receive it.&lt;/p&gt;

&lt;p&gt;Run the server with&lt;/p&gt;

&lt;p&gt;node server.js&lt;/p&gt;

&lt;h3&gt;
  
  
  App.vue
&lt;/h3&gt;

&lt;p&gt;Now, we will set up socket.io in client side.&lt;/p&gt;

&lt;p&gt;Run&lt;/p&gt;

&lt;p&gt;npm i socket.io-client&lt;/p&gt;

&lt;p&gt;inside the vue.js project from terminal.&lt;/p&gt;

&lt;p&gt;We will import the library by&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import io from ‘socket.io-client’
const socket = io(“[http://localhost:3000](http://localhost:3000)")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;inside the script section.&lt;/p&gt;

&lt;p&gt;In the created hook, we will listen to the event.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
You will see “youtube tutorial” will appear in the console.&lt;/p&gt;

&lt;p&gt;The client can also talk to the server in the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Game Logic with Socket.io
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;After we call the draw function, player 1 client will send the event to the server. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the server receives it, it will broadcast it to the player 2. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Player 2 will then update the grid. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then player 2 will click O and call the draw function, it will send the event to the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The server will broadcast it to player 1.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The game will keep going like this.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&amp;gt; # We also need to pass a parameter, drawFromOther, in the draw function. Depending upon this flag, we will emit the event again. If the drawFromOther flag is set to false, we will send the play event.

&lt;p&gt;Now, we will update the template. We will send the drawFromOtheras false, which means the event will be sent to the server.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Server.jswill receive the event and broadcast it.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Now, the client will receive the event in created hook.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
It will receive the event and draw at the index, but we pass drawFromOther param as true, so that the event does not again sent to the server.

&lt;h2&gt;
  
  
  Complete code of App.vue
&lt;/h2&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
That's it. The multiplayer game is ready to be played. Open localhost:8080 in two different browsers and click alternatively. The game should work.

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2886%2F1%2ASWKyuI8eXJrBMmBo7crogg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2886%2F1%2ASWKyuI8eXJrBMmBo7crogg.png"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>showdev</category>
      <category>vue</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Let’s Develop an E-Commerce Application from Scratch Using Spring Boot and Vue.js</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Sat, 30 Oct 2021 19:32:16 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-spring-boot-and-vuejs-2lm0</link>
      <guid>https://dev.to/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-spring-boot-and-vuejs-2lm0</guid>
      <description>&lt;h3&gt;
  
  
  Project set up and building admin panel for managing Category in Vue.js
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;In my opinion, the best way to learn programming is to create a real-life project which has practical use. This way, the entire learning experience becomes quite exciting. Also, you can showcase your app in your portfolio, which can help you a lot if you want to land a freelancing gig or in an interview.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  This tutorial is perfect for people who are starting their journey in Vue.js as we build it from scratch, integrate remote API call, router, break down UI into components, form handling as well as cover some important concepts like v-model, v-on.
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this series of blogs, you will amplify your development skills by learning how to build an e-commerce platform from scratch. I am good at backend development, and I wanted to learn Vue.js, so I learned it by creating this project. I wanted to share what I built, so I choose medium.com to share my journey.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Note to the reader
&lt;/h2&gt;

&lt;p&gt;Although I have built the entire application and wrote series of &lt;a href="https://medium.com/javarevisited/lets-develop-an-ecommerce-application-from-scratch-using-java-and-spring-6dfac6ce5a9f" rel="noopener noreferrer"&gt;tutorials&lt;/a&gt;, which are quite popular and top in google result, which I am very proud of, (more than 130K views in medium alone) I later found some parts are missing from those tutorials and some tutorials are not relevant anymore. For example, in some tutorials, we used vanilla JS and also started to develop an android app, which we discarded later. Also, the detailed explanation for each part was missing, as my focus was to build the application, less on writing tutorial.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AE_S48on3P7vpI75SX4zMOQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AE_S48on3P7vpI75SX4zMOQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, this is my attempt to redo the tutorials, deleting/editing some parts which are not relevant anymore and creating some tutorials which cover the missing pieces, so it will be very easy for the users to follow the tutorials.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backend Tutorial
&lt;/h2&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/nilmadhabmondal" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F550216%2F8c33f5c6-db02-4573-8807-087913986856.jpg" alt="nilmadhabmondal"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-java-and-spring-28go" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Let’s Develop an E-Commerce Application from Scratch Using Java and Spring&lt;/h2&gt;
      &lt;h3&gt;Nil Madhab ・ Oct 29 '21&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#java&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#vue&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  What we will cover in the tutorial
&lt;/h2&gt;

&lt;p&gt;This tutorial will focus on the front-end.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Set up a Vue.js project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configure router, API call, sweet alert&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a dashboard to list all the categories present in the backend&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adding and Editing Categories.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As part of building an E-Commerce application, previously we have configured the back end of this App and developed some APIs using Spring boot. If you are interested, you can check out this &lt;a href="https://dev.to/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-java-and-spring-28go"&gt;tutorial&lt;/a&gt;. But if you are only interested in the front-end, you can start directly from here.&lt;/p&gt;

&lt;p&gt;Every e-commerce store like Amazon will have millions of products, and they often belong to a category. For example, a shoe category consists of many shoes which are products. There can be a category, a sub-category, but for simplicity, we will just take categories and products.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2ASiNToBQgtsPUrXfpAdk_0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2ASiNToBQgtsPUrXfpAdk_0w.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let us see how to configure the front-end and create the user interface for category using one of the most popular JavaScript frameworks — Vue.js. Let’s get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Demo
&lt;/h2&gt;

&lt;p&gt;At the end of the tutorial, we will&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;list all categories&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2596%2F1%2AMB6aoXw_YhFz6z-OkVlhMA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2596%2F1%2AMB6aoXw_YhFz6z-OkVlhMA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add a new category&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3240%2F1%2AgH52b663GaVfVP03n-73Gg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3240%2F1%2AgH52b663GaVfVP03n-73Gg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Edit a category&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A6UkmaAjlkpmz_E2CxNXFRg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A6UkmaAjlkpmz_E2CxNXFRg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Start the project
&lt;/h2&gt;

&lt;p&gt;Let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F6962%2F0%2Aa9HbxKloNHUNXK02" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F6962%2F0%2Aa9HbxKloNHUNXK02" alt="Photo by [Braden Collum](https://unsplash.com/@bradencollum?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the command line and execute the following command to initiate a new Vue project, assuming you have vue.js installed or go to this &lt;a href="https://v3.vuejs.org/guide/installation.htm" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; vue create ecommerce-ui
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The command should work properly if you already have Vue CLI installed. Next, it will ask for some project configurations. Give the following data for configuring our front end Vue app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2594%2F1%2AgQaMQVZVo-4uLF-v1Fk5Qg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2594%2F1%2AgQaMQVZVo-4uLF-v1Fk5Qg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After confirming all the details, we will have a project folder created for us by Vue CLI.&lt;/p&gt;

&lt;p&gt;Go to the project folder and give the following command to run the application&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npm run serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;After the server got hosted and the application is started, you can go to &lt;a href="http://localhost:8080/" rel="noopener noreferrer"&gt;http://localhost:8080/&lt;/a&gt;. The response should be something similar to the output, as below-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2386%2F1%2AAb9tW8hDJtmChUPoU5jmxQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2386%2F1%2AAb9tW8hDJtmChUPoU5jmxQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yay! We have created our Vue app. Already off to a good start.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10944%2F0%2AMZ9OVQ5HC1wZD0fp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10944%2F0%2AMZ9OVQ5HC1wZD0fp" alt="Photo by [Peter Conlan](https://unsplash.com/@peterconlan?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project will have some files with .vue extension, which are called Vue components.&lt;/p&gt;
&lt;h2&gt;
  
  
  Vue Components
&lt;/h2&gt;

&lt;p&gt;Almost all frontend frameworks allow us to create components that we can reuse at multiple places on the same or different websites. Some examples include a search bar, login form, product display component, etc. In Vue, files with “.vue” extension are known as single file components. These single file components are composed of HTML, JavaScript, and CSS.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;!-- HTML Template --&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
  export default {}
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The template part contains the HTML of the component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The script tag contains the code defining the custom behavior of the component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The style tag houses the CSS of the component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;src/components and src/views contain all our components.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Agy9wCp55fKXeYyQDOsWNrg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Agy9wCp55fKXeYyQDOsWNrg.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Folder Structure
&lt;/h2&gt;

&lt;p&gt;Let’s go through the folder structure of our newly created Vue project&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;public&lt;/strong&gt; — contains the main HTML file of our project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/assets&lt;/strong&gt; — stores the media files like images, logos, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/components&lt;/strong&gt; — stores all the reusable components of our project. These components are not unique to some specific route.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Apart from this, we have some important files too&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;App.vue&lt;/strong&gt; — it is the root component of our project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;main.js&lt;/strong&gt; — it is the starting point of our project. Here we import our root component &lt;strong&gt;App.vue&lt;/strong&gt;, our router file &lt;strong&gt;index.js&lt;/strong&gt; and &lt;strong&gt;createApp&lt;/strong&gt; method. After this, we mount our root component to the DOM using the following statement:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    new Vue({
      render: h =&amp;gt; h(App),
    }).$mount('#app')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The folder structure is not enforced by Vue, we can customize this as per our requirements.&lt;/p&gt;

&lt;p&gt;And now we have our basic version of the front-end of our App where we will work more to add more functionalities. The basic project structure can be found in the following GitHub repository.&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/ecommerce-ui/tree/setup" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub — webtutsplus/ecommerce-ui at setup&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Building the UI for Category
&lt;/h2&gt;

&lt;p&gt;Once the basic structure is ready, we will start building the dashboard for categories.&lt;/p&gt;

&lt;p&gt;We will first add a router to our project. Run the following command in your command line to install the Vue router in your system&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vue add router
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;When asked to choose history mode, choose yes. Now if you run the app, you will see two links in the above.&lt;/p&gt;

&lt;p&gt;It will create a router directory with index.js file inside it. Also, it will create a views directory, with two files inside it, which are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;About.vue&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Home.vue&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AsBUmn5YGv5tL_zNEBKB6Xg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AsBUmn5YGv5tL_zNEBKB6Xg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run the front end application using the command &lt;strong&gt;&lt;em&gt;npm run serve&lt;/em&gt;&lt;/strong&gt;, you will see two links on thehomepage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Ayz6zkuZVOLDJ8jsA3Mxjbw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Ayz6zkuZVOLDJ8jsA3Mxjbw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AORA6PBsfHL2qR0IzPd0ISg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AORA6PBsfHL2qR0IzPd0ISg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We still have Helloworld component, let’s delete that. Also delete lines 4 and 10 and 15 from Home.vue, containing the Vue logo image and references to HelloWorld.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
If you run the app, you will see the following screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ArgGoP5WwMRXrvbSgLBEaSA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ArgGoP5WwMRXrvbSgLBEaSA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Styling the App
&lt;/h3&gt;

&lt;p&gt;Open the file index.html and replace the content with the following code.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
We just added some basic fonts, bootstrap.css and jQuery.
&lt;h2&gt;
  
  
  Adding a Category
&lt;/h2&gt;

&lt;p&gt;Time to create a form for adding category.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;We will create a directory Category inside the views directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a file *AddCategory.vue *inside it&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the content given below, which contains the form that takes input data for creating a category&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  v-model binding concept
&lt;/h3&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;As you can see, in the form, we have used v-model=”categoryName”. This is an important concept in Vue.js called &lt;a href="https://vuejs.org/v2/guide/forms.html" rel="noopener noreferrer"&gt;Form Input Bindings&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  You can use the v-model directive to create two-way data bindings on form input, textarea, and select elements. It automatically picks the correct way to update the element based on the input type. Although a bit magical, v-model is essentially syntax sugar for updating data on user input events, plus special care for some edge cases.Updating Router Paths
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;For our single-page application to run properly, we need to create router paths for our newly created components. Go to src/router/index.js file and update it as below by adding as well as importing AddCategory component.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    path: "/admin/category/add",
    name: "AddCategory",
    component: AddCategory,
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&amp;gt; # Notice although we have vue components both in views and components directory, the main difference is we use vue components in views directory to use in router, i.e each vue components in views directory mapped to a route.&lt;/p&gt;

&lt;p&gt;Now if we go to the page &lt;a href="http://localhost:8080/admin/category/add" rel="noopener noreferrer"&gt;http://localhost:8080/admin/category/add&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2490%2F1%2A_vFIdmIAYW4fdX5EJCe8QA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2490%2F1%2A_vFIdmIAYW4fdX5EJCe8QA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Axios and sweetalert integration
&lt;/h3&gt;

&lt;p&gt;Axios is a popular, promise-based HTTP client that sports an easy-to-use API and can be used in both the browser and Node&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run the command npm install --save axios&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We add the following line in main.js window.axios = require('axios')&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We will also install the package npm install --save sweetalert&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  API call
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;First, we will trigger addCategory function, by clicking the submit button. We can do it easily by adding the code &lt;a class="mentioned-user" href="https://dev.to/click"&gt;@click&lt;/a&gt;="addCategory" in submit button, so it looks like this
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

We will define a function in the methods section inside the script tag.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Base url
&lt;/h3&gt;

&lt;p&gt;We have hosted our backend on Heroku, which you can access by the endpoint, &lt;a href="https://limitless-lake-55070.herokuapp.com/swagger-ui.html#/category-controller/getCategoriesUsingGET" rel="noopener noreferrer"&gt;https://limitless-lake-55070.herokuapp.com/swagger-ui.html#/category-controller&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will define &lt;a href="https://limitless-lake-55070.herokuapp.com/" rel="noopener noreferrer"&gt;https://limitless-lake-55070.herokuapp.com/&lt;/a&gt; as our base url and to create a new category, we need to hit,&lt;/p&gt;

&lt;p&gt;For adding a new category, we need to hit the baseURL + “category/create” with this JSON with a post request, of request body.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Which we will implement in the script section.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2256%2F1%2AqOyjueQLHgE1HozHbdKyhw.png"&gt;

&lt;p&gt;The complete code until this stage of this application can be found in the GitHub repository given below.&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/ecommerce-ui/tree/category-add" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub — webtutsplus/ecommerce-ui at category-add&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F12000%2F0%2ABClSZbSwiZ6H_mwj" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F12000%2F0%2ABClSZbSwiZ6H_mwj" alt="Photo by [IA SB](https://unsplash.com/@iasb?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nice job guys, if you succeeded in making it so far. Next, we will start with displaying the categories. If not, you can run the above Github repo in your local machine, it should work.&lt;/p&gt;
&lt;h2&gt;
  
  
  Displaying the Categories
&lt;/h2&gt;

&lt;p&gt;Now, we can create a new category, time to display all the categories in a nice manner.&lt;/p&gt;

&lt;p&gt;Our final result of displaying the categories will be as shown below-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ArpdeQRKI4XkjRwNA7r8mYw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ArpdeQRKI4XkjRwNA7r8mYw.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Component Breakdown
&lt;/h2&gt;

&lt;p&gt;To display all the categories, we need to create a view for that. Create a file named Category.vue under src/views/Category folder. This view is used to display the categories that are fetched from the database. This view also holds the references that will redirect us to AddCategory view.&lt;/p&gt;

&lt;p&gt;In modern frontend framework like Vue.js/react, we break down our UI into small components for reusability.&lt;/p&gt;

&lt;p&gt;Here we will also break down this by each category. This will be a component-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AbjOPGgszAqGaXnvQJ5tKKw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AbjOPGgszAqGaXnvQJ5tKKw.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  CategoryBox.vue component
&lt;/h2&gt;

&lt;p&gt;We will create a directory Category in src/components and create CategoryBox.vue file in it.&lt;/p&gt;

&lt;p&gt;It will have a prop category which will be passed from a parent view, and it will just display the category with an option to go to the edit page, which we will build in the next chapter.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Category.vue component
&lt;/h2&gt;

&lt;p&gt;Now it’s time to create the component for listing all the categories!&lt;/p&gt;

&lt;p&gt;This component fetches the categories from the back-end using axios and passes each category as a prop to CategoryBox component, which displays each category. Finally, the component will be a collection of categories displayed in CategoryBox components.&lt;/p&gt;

&lt;p&gt;Go to src/views/Category/Category.vue file that we have already created and update it with the following code!&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Updating the Routes
&lt;/h2&gt;

&lt;p&gt;And as the final step, let us create the router path for this component to display all the categories. The following route will be appended to the routes-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    path: "/admin/category",
    name: "AdminCategory",
    component: Category,
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The complete index.js file is as below-&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Vue from "vue";
import VueRouter from "vue-router";
import AddCategory from "../views/Category/AddCategory";
import Category from "../views/Category/Category";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =&amp;gt;
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/admin/category/add",
    name: "AddCategory",
    component: AddCategory,
  },
  {
    path: "/admin/category",
    name: "AdminCategory",
    component: Category,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2372%2F1%2AG0FATh9mPwtfPWCtrVM1LQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2372%2F1%2AG0FATh9mPwtfPWCtrVM1LQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The complete code until this stage of the application can be found in the GitHub repository given below-&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/ecommerce-ui/tree/category-display" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub — webtutsplus/ecommerce-ui at category-display&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F6064%2F0%2AMaB9sxu8wsq2LBUz" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F6064%2F0%2AMaB9sxu8wsq2LBUz" alt="Photo by [Nick Fewings](https://unsplash.com/@jannerboy62?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep going on guys. Next, we will move to editing category.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/VZ1NV7EHGJw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;h2&gt;
  
  
  Editing a Category
&lt;/h2&gt;

&lt;p&gt;Open src/views/Category folder and create a file for EditCategory view with the boilerplate code as below.&lt;/p&gt;

&lt;p&gt;Pretty simple, we are just defining the three sections, template, script and style.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;h2&gt;
  
  
  Add the form
&lt;/h2&gt;

&lt;p&gt;Now, we will add the form to edit the category. It will be a form similar to AddCategory view. We also define 5 variables id, categoryName, description, imageUrl, categoryIndex and initialize those to null. We will also define the baseUrl&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Send the category data to view
&lt;/h2&gt;

&lt;p&gt;Now the question is how do we get the data from the Category home page to this view. The answer is simple. First, we create a router for the view. We set props: true at line 5. We will pass the Category data which we need to edit as prop.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Add option to edit
&lt;/h2&gt;

&lt;p&gt;Now, we will add an option to edit a category in the CategoryBox. Line number 10–12.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AsyXZUPc9Op9zjoPk3Ez_2Q.png"&gt;

&lt;h2&gt;
  
  
  Update the script
&lt;/h2&gt;

&lt;p&gt;Now, we will create one prop category and in the mounted section we populate all the data.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
That’s it, now if we click the edit button in categoryBox, we will see the data.

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3074%2F1%2AsEs9WyAfWpZXXzizA6Hi_Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3074%2F1%2AsEs9WyAfWpZXXzizA6Hi_Q.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  API call to save the data
&lt;/h2&gt;

&lt;p&gt;Now, we have only one thing left, how to update the data in the remote server?&lt;/p&gt;

&lt;p&gt;We will define a function editCategory in the method section. We will call this function in the submit button.&lt;/p&gt;

&lt;p&gt;Submit&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2294%2F1%2AoSo4wA1XSSJpJbwGj03GfQ.png"&gt;

&lt;p&gt;The complete code for EditCategory.vue&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
The complete project for this tutorial can be found in the GitHub repository given below-&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/ecommerce-ui/tree/category-edit" rel="noopener noreferrer"&gt;GitHub — webtutsplus/ecommerce-ui at category-edit&lt;/a&gt;

&lt;p&gt;Hurray! We have completed the part of building the front end to create categories using Vue.js! But wait! There are a lot more to learn in this tutorial series! Stay tuned until then!&lt;/p&gt;

&lt;p&gt;Let me know in comment, if you like the tutorial, or you like any improvement to understand it better,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Happy learning!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Let’s Develop an E-Commerce Application from Scratch Using Java and Spring</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 29 Oct 2021 08:01:22 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-java-and-spring-28go</link>
      <guid>https://dev.to/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-java-and-spring-28go</guid>
      <description>&lt;h3&gt;
  
  
  Project setup, develop category and product APIs
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;In my opinion, the best way to learn programming is to create a real-life project which has practical use, this way the entire learning experience becomes quite exciting. Also, you can showcase your app in your portfolio, which can help you a lot if you want to land a freelancing gig or in an interview.&lt;/p&gt;

&lt;p&gt;In this series of blogs, you will amplify your development skills by learning how to build an e-commerce platform from scratch. First, you have to be familiar with &lt;a href="https://medium.com/javarevisited/10-best-places-to-learn-java-online-for-free-ce5e713ab5b2" rel="noopener noreferrer"&gt;Java&lt;/a&gt; and Spring Boot, which we will use to build the backend, and &lt;a href="https://medium.com/javarevisited/10-free-vue-js-nuxt-js-online-courses-for-beginners-in-2021-a347ea2ad144" rel="noopener noreferrer"&gt;Vue.js&lt;/a&gt;, which we will use for the frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note to the reader:
&lt;/h2&gt;

&lt;p&gt;Although I have built the entire application and wrote a series of &lt;a href="https://medium.com/javarevisited/lets-develop-an-ecommerce-application-from-scratch-using-java-and-spring-6dfac6ce5a9f" rel="noopener noreferrer"&gt;tutorials&lt;/a&gt;, which are quite popular and top in google result, which I am very proud of, (more than 130K views in medium alone)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2100%2F1%2AsiiPfKr7krKjzBBuSIh3Vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2100%2F1%2AsiiPfKr7krKjzBBuSIh3Vw.png" alt="top in google result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2120%2F1%2AUgpeM6nrdE1kHqXSnxHApg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2120%2F1%2AUgpeM6nrdE1kHqXSnxHApg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I later found some parts are missing from those tutorials and some tutorials are not relevant anymore. For example, in some tutorials, we used vanilla JS and also started to develop an &lt;a href="https://medium.com/javarevisited/7-free-flutter-online-courses-to-build-android-and-ios-apps-in-2021-54c0c92f16f9" rel="noopener noreferrer"&gt;android app&lt;/a&gt;, which we discarded later.&lt;/p&gt;

&lt;p&gt;So, this is my attempt to redo the tutorials, deleting/editing some parts which are not relevant anymore and creating some tutorials which cover the missing pieces, so it will be very easy for the users to follow the tutorials.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Video&lt;/strong&gt; tutorial
&lt;/h2&gt;

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

&lt;h2&gt;
  
  
  Playlist
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/playlist?list=PLzXSm2gSfuPIIoymeZWdH_uRWqIIT-iQy" rel="noopener noreferrer"&gt;Frontend&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/playlist?list=PLzXSm2gSfuPJc2sSAmmud6TLpx0H7otyd" rel="noopener noreferrer"&gt;Backend&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Frontend tutorial in Vue
&lt;/h2&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/nilmadhabmondal" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F550216%2F8c33f5c6-db02-4573-8807-087913986856.jpg" alt="nilmadhabmondal"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/nilmadhabmondal/lets-develop-an-e-commerce-application-from-scratch-using-spring-boot-and-vuejs-2lm0" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Let’s Develop an E-Commerce Application from Scratch Using Spring Boot and Vue.js&lt;/h2&gt;
      &lt;h3&gt;Nil Madhab ・ Oct 30 '21&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#vue&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Creating the Project
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First, go to &lt;a href="https://start.spring.io/" rel="noopener noreferrer"&gt;https://start.spring.io/&lt;/a&gt; where we can create new spring app and add dependencies&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select maven, add &lt;a href="https://javarevisited.blogspot.com/2021/08/top-5-spring-data-jpa-courses-for-java.html" rel="noopener noreferrer"&gt;Spring Data JPA&lt;/a&gt; and Spring Web dependencies&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2690%2F1%2A-C_FlCw8WFUmhb_A7FM4_A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2690%2F1%2A-C_FlCw8WFUmhb_A7FM4_A.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on Generate and download the .zip file, uncompress it and open it using the &lt;a href="https://medium.com/javarevisited/7-best-courses-to-learn-intellij-idea-for-beginners-and-experienced-java-programmers-2e9aa9bb0c05" rel="noopener noreferrer"&gt;IntelliJ Idea&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2184%2F1%2AgO84VoYpy6C1qnzWJb8LBg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2184%2F1%2AgO84VoYpy6C1qnzWJb8LBg.png"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Main class
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;src/main/java&lt;/em&gt; folder of the project contains a class that has a main method. It is the entry point for the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  application.properties
&lt;/h3&gt;

&lt;p&gt;In &lt;em&gt;src/main/resources&lt;/em&gt; folder there will be a file named &lt;strong&gt;application.properties&lt;/strong&gt;. This file will play a major role in conveying the spring the configurations that we make and how it should create the object for us. In other words, it plays a major role in &lt;a href="https://javarevisited.blogspot.com/2012/12/inversion-of-control-dependency-injection-design-pattern-spring-example-tutorial.html#axzz6u4HTHz4Z" rel="noopener noreferrer"&gt;Inversion of Control(IoC)&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  pom.xml
&lt;/h3&gt;

&lt;p&gt;In the project folder, there will be a file called &lt;code&gt;pom.xml&lt;/code&gt;. This file is where we will be adding all the required dependencies.&lt;/p&gt;

&lt;p&gt;Now, the project structure will be as below-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ArPf7v55UExPK1fsvGGpjgA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ArPf7v55UExPK1fsvGGpjgA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check the project structure of the backend in the GitHub repository branch given below-&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/ecommerce" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub — webtutsplus/ecommerce&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Overview of our Backend Application
&lt;/h2&gt;

&lt;p&gt;In this Spring Application, following are important packages that you have to know before starting.&lt;/p&gt;

&lt;p&gt;This is spring architecture. The outside world calls the &lt;a href="https://medium.com/javarevisited/10-best-java-web-services-rest-soap-and-api-courses-for-beginners-724a8f51298d" rel="noopener noreferrer"&gt;REST APIs&lt;/a&gt;, which interact with the &lt;a href="https://javarevisited.blogspot.com/2017/08/difference-between-restcontroller-and-controller-annotations-spring-mvc-rest.html#ixzz6OYNB9oii" rel="noopener noreferrer"&gt;controller&lt;/a&gt;, which interacts with the Service. Service calls the repository.&lt;/p&gt;

&lt;p&gt;The repository interacts with the database. We follow this pattern to make the codebase maintainable, instead of having spaghetti code, which can be a nightmare in long term.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AaCDU4twFx5VuwdIyebYcdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AaCDU4twFx5VuwdIyebYcdw.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Model / Entity
&lt;/h2&gt;

&lt;p&gt;Model is the basic entity that has a direct relationship with the structure of a table in the &lt;a href="https://medium.com/javarevisited/top-10-free-courses-to-learn-microsoft-sql-server-and-oracle-database-in-2020-6708afcf4ad7" rel="noopener noreferrer"&gt;database&lt;/a&gt;. In other words, these models serve as containers that hold similar and relative data that are used to transport these data from clients to the database. User Profile, Product, and Category are some models in our backend application.&lt;/p&gt;
&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Repository is an interface that acts as a bridge between the database and the application. It carries the model data to and from the database. Every model will have a unique repository for the data transportation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Service
&lt;/h2&gt;

&lt;p&gt;Service is the part of the architecture where the repository is instantiated, and business logic is applied. The data from the client reaching here is manipulated and sent through the repository to the database.&lt;/p&gt;
&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://javarevisited.blogspot.com/2017/11/difference-between-component-service.html" rel="noopener noreferrer"&gt;controller &lt;/a&gt;is the part of the architecture where the requests from the clients are first handled. It controls the processes that should run on the backend and the response that has to be elicited to the clients. It interacts with the service which in turn interacts with the repository which in turn interacts with the database using models.&lt;/p&gt;
&lt;h2&gt;
  
  
  Journey of Data
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3594%2F1%2Aid0h3W4lWbFo8i-9BPGkCg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3594%2F1%2Aid0h3W4lWbFo8i-9BPGkCg.png" alt="How the data moves"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Designing the Category API
&lt;/h2&gt;

&lt;p&gt;Once we have the basic structure ready, it is time to add some product and categories for our ecommerce store.&lt;/p&gt;

&lt;p&gt;Take as an example, we can have a category of shoe and have different types of shoes as product. So one category can have many products, but each product will belong to one category.&lt;/p&gt;
&lt;h2&gt;
  
  
  Model
&lt;/h2&gt;

&lt;p&gt;First we will create a model, Category It will have four fields.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;id&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;categoryName&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;description&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;imageUrl&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We will also create a setter and getter for the four fields.&lt;/p&gt;

&lt;p&gt;It will have a corresponding table categories in the &lt;a href="https://medium.com/javarevisited/8-free-oracle-database-and-sql-courses-for-beginners-f4e9b25b33c4" rel="noopener noreferrer"&gt;database&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
We are using @NotBlank annotation for the category. For that, we have to include the following dependency in pom.xml file.
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


    &amp;lt;dependency&amp;gt;

      &amp;lt;groupId&amp;gt;javax.validation&amp;lt;/groupId&amp;gt;

      &amp;lt;artifactId&amp;gt;validation-api&amp;lt;/artifactId&amp;gt;

    &amp;lt;/dependency&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Now we will create a repository Categoryrepository.java that will extend JpaRepository.&lt;/p&gt;

&lt;p&gt;It will have a method findByCategoryName.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Service
&lt;/h2&gt;

&lt;p&gt;Now we will create a CategoryService file that will be responsible to create, update or fetching repositories.&lt;/p&gt;

&lt;p&gt;The Categoryrepository has inbuilt methods findAll(), save() as it is extending JpaRepository&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;We will create a helper class ApiResponse.java, which will be used to return a response for the APIs.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Now we will create the controller which will contain all the APIs

&lt;p&gt;We will create 3 APIs for category&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;create&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;update&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;list all category&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

We will also add swagger for easy testing of the code.
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

We need to also add these dependencies in pom.xml file for swagger and h2 in memory database. But you are free to choose any other database of your choice.
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;dependency&amp;gt;

  &amp;lt;groupId&amp;gt;io.springfox&amp;lt;/groupId&amp;gt;

  &amp;lt;artifactId&amp;gt;springfox-bean-validators&amp;lt;/artifactId&amp;gt;

  &amp;lt;version&amp;gt;2.9.2&amp;lt;/version&amp;gt;

&amp;lt;/dependency&amp;gt;

&amp;lt;dependency&amp;gt;

  &amp;lt;groupId&amp;gt;io.springfox&amp;lt;/groupId&amp;gt;

  &amp;lt;artifactId&amp;gt;springfox-swagger2&amp;lt;/artifactId&amp;gt;

  &amp;lt;version&amp;gt;2.9.2&amp;lt;/version&amp;gt;

&amp;lt;/dependency&amp;gt;

&amp;lt;dependency&amp;gt;

  &amp;lt;groupId&amp;gt;io.springfox&amp;lt;/groupId&amp;gt;

  &amp;lt;artifactId&amp;gt;springfox-swagger-ui&amp;lt;/artifactId&amp;gt;

  &amp;lt;version&amp;gt;2.9.2&amp;lt;/version&amp;gt;

&amp;lt;/dependency&amp;gt;

&amp;lt;dependency&amp;gt;

  &amp;lt;groupId&amp;gt;com.h2database&amp;lt;/groupId&amp;gt;

  &amp;lt;artifactId&amp;gt;h2&amp;lt;/artifactId&amp;gt;

  &amp;lt;scope&amp;gt;runtime&amp;lt;/scope&amp;gt;

&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
We also have to modify our application.properties file by adding the lines
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spring.datasource.url=jdbc:h2:mem:testdb

spring.datasource.driverClassName=org.h2.Driver

spring.datasource.username=sa

spring.datasource.password=password

spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Now, run the code and open [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html) page. We will see this screen

![](https://cdn-images-1.medium.com/max/2000/1*DmVIKGkSSW14pNJOcLe9-g.png)

## Demo

Let’s create a category watch, with this request body. (Note: we do not need to pass id here, it will be auto created.)

    {
      "categoryName": "watches",
      "description": "best watches",
      "imageUrl": "https://images.unsplash.com/photo-1524805444758-089113d48a6d?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;amp;ixlib=rb-1.2.1&amp;amp;auto=format&amp;amp;fit=crop&amp;amp;w=634&amp;amp;q=80"
    }

![](https://cdn-images-1.medium.com/max/2000/1*RRebmprvGLgUnrr53Fqr8g.png)

You will get the response as below-

![](https://cdn-images-1.medium.com/max/2000/1*w91nIxx7X0dIU_g5QQPibA.png)

Now, let us hit the get API

![](https://cdn-images-1.medium.com/max/2018/1*7rtYwUNeqt37NzAr-CyRYQ.png)

We will get the following response-

    [
      {
        "id": 1,
        "categoryName": "watches",
        "description": "best watches",
        "imageUrl": "https://images.unsplash.com/photo-1524805444758-089113d48a6d?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;amp;ixlib=rb-1.2.1&amp;amp;auto=format&amp;amp;fit=crop&amp;amp;w=634&amp;amp;q=80"
      }
    ]

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


## Enable CORS

We will add the webconfig.java file, so that our [front end](https://medium.com/javarevisited/6-best-frontend-development-courses-for-beginners-to-learn-in-2021-f2772157864) can hit the API.
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;Hurray! We can now play with the APIs and can create some new category, update and fetch all the categories.&lt;/p&gt;
&lt;h2&gt;
  
  
  Designing the Product API
&lt;/h2&gt;

&lt;p&gt;Now we have some categories, it is time to make the products APIs. First, we will create the model, then we will create the repository, then we will make the service and at the end, we will create the controller and test it.&lt;/p&gt;

&lt;p&gt;&lt;iframe&gt;
  width="710"&lt;br&gt;
  height="399"&lt;br&gt;
  src="https://www.youtube.com/embed/hUXfesLKl88"&lt;br&gt;
  allowfullscreen&lt;br&gt;
  loading="lazy"&amp;gt;&lt;br&gt;
&lt;/iframe&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Model
&lt;/h2&gt;

&lt;p&gt;Product will have id, name, imageURL, price, description as well as a foreign key to category, as every product belong to a category.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Entity
@Table(name = "products")
public class Product {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private @NotNull String name;
    private @NotNull String imageURL;
    private @NotNull double price;
    private @NotNull String description;

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "category_id", nullable = false)
    Category category;


    public Product(String name, String imageURL, double price, String description, Category category) {
        super();
        this.name = name;
        this.imageURL = imageURL;
        this.price = price;
        this.description = description;
        this.category = category;
    }
// setters and getters
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Next, we will create a file, ProductRepository.java in repository package, which will just extend &lt;a href="https://www.java67.com/2021/01/spring-data-jpa-interview-questions-answers-java.html" rel="noopener noreferrer"&gt;JpaRepository&lt;/a&gt;. If we need some methods, we will add it later&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.educative.ecommerce.repository;

import com.educative.ecommerce.model.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ProductRepository extends JpaRepository&amp;amp;lt;Product, Integer&amp;amp;gt; {

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Service
&lt;/h2&gt;

&lt;p&gt;Now we are ready to create the service class. Create a file ProductService.java in service directory. It will have an autowired ProductRepository.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Service
public class ProductService {

@Autowired
    private ProductRepository productRepository;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  DTO concept&lt;a href="https://www.educative.io/pageeditor/5948990638522368/5499519291097088/5793128230944768#DTO-concept" rel="noopener noreferrer"&gt;#&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Before creating a product, we need to understand, what is a DTO (data transfer object)&lt;/p&gt;

&lt;p&gt;Martin Fowler introduced the concept of a Data Transfer Object (DTO) as an object that carries data between processes.&lt;/p&gt;

&lt;p&gt;In category controller, we directly used the model as request body, but that is not practical in many cases. We need to create a different object because&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;sometimes we might have to change the model, and we do not want to change the API for backward compatibility&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can’t use the model as request body if it has relationship with another model.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So quickly, we will create a package &lt;em&gt;dto&lt;/em&gt; and inside the package we will create another package product, and there we will create our ProductDto.java class, which will have the following attributes&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private Integer id;
private @NotNull String name;
private @NotNull String imageURL;
private @NotNull double price;
private @NotNull String description;
private @NotNull Integer categoryId;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;We are also passing categoryId, because we need this to link a product with a category.&lt;/p&gt;
&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;Now as we have the productDto ready, now time to create ProductController.java class&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@RestController
@RequestMapping("/product")
public class ProductController {

@Autowired
    ProductService productService;
    @Autowired
    CategoryService categoryService;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;It will autowire ProductService and CategoryService&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a new product API
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@PostMapping("/add")
    public ResponseEntity&amp;amp;lt;ApiResponse&amp;amp;gt; addProduct(@RequestBody ProductDto productDto) {
        Optional&amp;amp;lt;Category&amp;amp;gt; optionalCategory = categoryService.readCategory(productDto.getCategoryId());
        if (!optionalCategory.isPresent()) {
            return new ResponseEntity&amp;amp;lt;ApiResponse&amp;amp;gt;(new ApiResponse(false, "category is invalid"), HttpStatus.CONFLICT);
        }
        Category category = optionalCategory.get();
        productService.addProduct(productDto, category);
        return new ResponseEntity&amp;amp;lt;&amp;amp;gt;(new ApiResponse(true, "Product has been added"), HttpStatus.CREATED);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;We will receive categoryId and product details from the request body.&lt;/p&gt;

&lt;p&gt;First, we will check if the categoryId is valid or return “category is invalid” error.&lt;/p&gt;

&lt;p&gt;Then we will create a product by calling method, productService.addProduct which takes productDto and category as arguments.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void addProduct(ProductDto productDto, Category category) {
        Product product = getProductFromDto(productDto, category);
        productRepository.save(product);
    }

public static Product getProductFromDto(ProductDto productDto, Category category) {
        Product product = new Product();
        product.setCategory(category);
        product.setDescription(productDto.getDescription());
        product.setImageURL(productDto.getImageURL());
        product.setPrice(productDto.getPrice());
        product.setName(productDto.getName());
        return product;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The complete code can be found in the GitHub repository given below-&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/ecommerce/tree/product-apis" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub — webtutsplus/ecommerce at product-apis&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this marks the end of this tutorial. But wait! The tutorial series will continue for building the UI using &lt;a href="https://medium.com/javarevisited/top-5-online-courses-to-learn-vue-js-in-2021-249e66b60646" rel="noopener noreferrer"&gt;Vue.js&lt;/a&gt; for the above-developed backend application. Till that, stay tuned!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Happy Learning&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Continue to the next tutorial, where we will use the API to make a frontend using vue.js&lt;/p&gt;

&lt;p&gt;&lt;a href="https://javascript.plainenglish.io/lets-develop-an-e-commerce-application-from-scratch-using-spring-boot-and-vue-js-aca33bd76517" rel="noopener noreferrer"&gt;https://javascript.plainenglish.io/lets-develop-an-e-commerce-application-from-scratch-using-spring-boot-and-vue-js-aca33bd76517&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>java</category>
      <category>vue</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Let’s Build a WhatsApp Clone Using Vue.js and Firebase</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 23 Apr 2021 16:48:40 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/let-s-build-a-whatsapp-clone-using-vue-js-and-firebase-71l</link>
      <guid>https://dev.to/nilmadhabmondal/let-s-build-a-whatsapp-clone-using-vue-js-and-firebase-71l</guid>
      <description>&lt;h2&gt;
  
  
  Let’s Build a WhatsApp Clone Using Vue.js and Firebase
&lt;/h2&gt;

&lt;p&gt;How to build a clone of WhatsApp Web Using Vue.js, Firebase, and Spring Boot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5572%2F1%2AU6iilfktVJipMcEM79O1OQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5572%2F1%2AU6iilfktVJipMcEM79O1OQ.png" alt="Whatspp Clone for realtime chat"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We use a lot of social media platforms every day, like Facebook, LinkedIn, Twitter, Whatsapp, Instagram. One of the most used features every day is real time chat. In this tutorial, we are going to build one, using Vue.js and Firebase.&lt;/p&gt;

&lt;p&gt;This is part of a series of tutorials, where we will be building a fully functional social networking app, where users can log in, post, add friends, and chat.&lt;/p&gt;

&lt;p&gt;Previously, we used Firebase to create a social login using Spring Boot in the backend and Vue.js in the frontend.&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-build-a-robust-social-login-using-spring-boot-vue-js-and-firebase-36fc5bac0d0b" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Build a Robust Social Login Using Spring Boot, Vue.js and Firebase&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live Demo:&lt;br&gt;
&lt;a href="https://simplecoding-social.netlify.app/" rel="noopener noreferrer"&gt;&lt;strong&gt;simplecoding-social&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github code for this tutorial:&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/social-network-frontend/tree/whatapp-tutorial" rel="noopener noreferrer"&gt;&lt;strong&gt;webtutsplus/social-network-frontend&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Ay-jQn6Nvelqg8-8lkfeASg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Ay-jQn6Nvelqg8-8lkfeASg.png" alt="Relevant files for this tutorial"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Let’s Build the Chat page
&lt;/h2&gt;

&lt;p&gt;Let's build the view for the entire page, it has two components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ChatSidebar&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ChatView&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AmqxiM6_jXbYuGMoocQkbyg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AmqxiM6_jXbYuGMoocQkbyg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3632%2F1%2AbcOv46UhYItqXb7EgKpUYA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3632%2F1%2AbcOv46UhYItqXb7EgKpUYA.png" alt="ChatSidebar and ChatView components"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
For each friend, we have a room name, which we store in the backend. And we retrieve it via this API.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Complete code for the above can be found here:&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/social-network-frontend/blob/whatapp-tutorial/src/views/Chat.vue" rel="noopener noreferrer"&gt;&lt;strong&gt;webtutsplus/social-network-frontend&lt;/strong&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Response of the API&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Once we have the rooms information, we send it to the child components. Let's look at the ChatSidebar component
&lt;h2&gt;
  
  
  ChatSidebar Component
&lt;/h2&gt;

&lt;p&gt;It gets the rooms prop from the parent Chat and display a list of &lt;strong&gt;SidebarChatUserRow&lt;/strong&gt; components for each user from the rooms list prop passed from parent Chat.vue.&lt;/p&gt;

&lt;p&gt;It also has 3 icons in the top right, which look really good!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ABd6yDKJE0rnSNim3itt_qw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ABd6yDKJE0rnSNim3itt_qw.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;SidebarChatUserRow component&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This component is very simple — it’s just to display the email and avatar for each user. We can add the last message later, if we want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AiASVNPS7dLSkZO9-15qe9A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AiASVNPS7dLSkZO9-15qe9A.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  ChatView component
&lt;/h2&gt;

&lt;p&gt;This is the right side part of the chat, where we display the actual chats. First, we will discuss how we are displaying the chats and then we will see, when we click a different user, how to update the chats.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3668%2F1%2Ax2M0pY1heUMnRkVLok4slA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3668%2F1%2Ax2M0pY1heUMnRkVLok4slA.png" alt="chat main"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, we pass the first user’s room, so it has a prop room, which also has the user information (avatar, email) which we display in the header.&lt;/p&gt;

&lt;p&gt;From the roomname, we find the associated roomId in Firebase and get all the associated chats and display those chats.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2252%2F1%2AEXMzTn79VtLxpyzMM7yU7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2252%2F1%2AEXMzTn79VtLxpyzMM7yU7g.png" alt="Firebase chats store"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Creating a new chat
&lt;/h2&gt;

&lt;p&gt;There is a form, where we hide the send button and onclick action. We prevent the default submit and refresh action of form by v-on:submit.prevent directive.&lt;/p&gt;

&lt;p&gt;We get the data for inputMsg div and add a new entry in firebase by adding the chat in room name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3744%2F1%2AQg4hHsm9iXs5rIbYTStt2g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3744%2F1%2AQg4hHsm9iXs5rIbYTStt2g.png" alt="submit form"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Now we have one important function left, which is about selecting a different friend from the Sidechatbar and how to update the chatview.

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5276%2F1%2AUHbXsLXR7qqyWOwS8N5YdA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5276%2F1%2AUHbXsLXR7qqyWOwS8N5YdA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As they are not a parent-child type, we can’t directly pass prop or update the props. The answer is emitting the event and listening for it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2200%2F1%2AnCVbuO4UOfKyY0e6VLO1Tg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2200%2F1%2AnCVbuO4UOfKyY0e6VLO1Tg.png" alt="Emit an event in **SidebarChatUserRow** component"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3632%2F1%2AMte9u27vGsahn0V64E7eFQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3632%2F1%2AMte9u27vGsahn0V64E7eFQ.png" alt="Retrieving the event in Chatview and updating everything"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The complete code for the chatview.view component:&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/social-network-frontend/blob/whatapp-tutorial/src/components/Chat/ChatView.vue" rel="noopener noreferrer"&gt;&lt;strong&gt;webtutsplus/social-network-frontend&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, we have covered some really interesting modern JavaScript topics like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;How to pass props.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to render components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to emit events and use them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to integrate Firebase.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. You can run the frontend code on your local computer and comment here if anything goes wrong. Thanks for reading!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://medium.com/javarevisited/lets-build-a-robust-social-login-using-spring-boot-vue-js-and-firebase-36fc5bac0d0b" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Build a Robust Social Login Using Spring Boot, Vue.js and Firebase&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;More content at &lt;a href="http://plainenglish.io/" rel="noopener noreferrer"&gt;plainenglish.io&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsappclone</category>
      <category>socialmediaapp</category>
      <category>vue</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Let’s Build Backend for Posts in Our Social Network App using Spring</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 23 Apr 2021 16:44:05 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/let-s-build-backend-for-posts-in-our-social-network-app-using-spring-32ik</link>
      <guid>https://dev.to/nilmadhabmondal/let-s-build-backend-for-posts-in-our-social-network-app-using-spring-32ik</guid>
      <description>&lt;p&gt;In this tutorial, we are going to add a Posts feature using Springboot Backend for a demo social network site we are building.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5736%2F1%2AF3gW49rAYaG9NIjcVUr6mQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5736%2F1%2AF3gW49rAYaG9NIjcVUr6mQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We use a lot of social media platforms every day, like Facebook, Linkedin, Twitter, Whatsapp, Instagram. I always wanted to build one myself. So in this series of tutorials, we are going to build one from scratch. It has currently following features now&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Users can log in by email or Github.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Users can add each other as friends.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Users can post and see each other’s posts (only text, images and videos are not yet supported)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Users can chat with their friends in whatsapp like interface.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We have used &lt;a href="https://medium.com/javarevisited/top-5-online-courses-to-learn-vue-js-in-2021-249e66b60646" rel="noopener noreferrer"&gt;Vue.js &lt;/a&gt;as a frontend framework, which we deployed using Netlify and &lt;a href="https://medium.com/javarevisited/top-10-courses-to-learn-spring-boot-in-2020-best-of-lot-6ffce88a1b6e" rel="noopener noreferrer"&gt;Spring Boot&lt;/a&gt; as backend, deployed in Heroku.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will discuss the backend of Posts.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Complete Series&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Previously we have built, login system and friends features. We will extend to posts feature now.&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-build-a-robust-social-login-using-spring-boot-vue-js-and-firebase-36fc5bac0d0b" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Build a Robust Social Login Using Spring Boot, Vue.js and Firebase&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-build-backend-for-friends-in-our-social-network-app-using-spring-262bdeba926a" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Build Backend for Friends in Our Social Network App using Spring&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Live Demo
&lt;/h1&gt;
&lt;h1&gt;
  
  
  &lt;a href="https://simplecoding-social.netlify.app/" rel="noopener noreferrer"&gt;https://simplecoding-social.netlify.app/&lt;/a&gt;
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Pre-Requisites :
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The basic knowledge of Java programming language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An idea of &lt;a href="https://spring.io/guides/gs/spring-boot/" rel="noopener noreferrer"&gt;SpringBoot MVC&lt;/a&gt; file structure and working principles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic knowledge of creating APIs and working with JSON requests &amp;amp; responses.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Goals
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Users should able to Post content (API to add a post).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user should be able to see his own Posts (API to see posts by the user himself).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Users should be able to see all the Posts (API to get all posts).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Users should be able to see the posts of specific users(e.g. friend’s post).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Road Map
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a Model to store the records in the database in the specified format.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Repository to add custom User-defined methods to interact with the model and get required data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Service to perform a CRUD operation on the database by using repository methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Controller to add API endpoints to interact with Users or Frontend Developers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Let’s Get Started.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Model
&lt;/h2&gt;

&lt;p&gt;The model defines the structure/format in which the data has to be stored in the database. It represents the java object carrying the data.&lt;/p&gt;

&lt;p&gt;create Post.java Model class and paste the following code :&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Note, that we have declared 3 entities in our Post model Id, User, Content.

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The id represents the unique identification of the record.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Content will store the string content provided by the User.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Record creation date and time will be stored into ‘CreatedDate’ column of the Table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user_id column will store the id of the user.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, we have created a model for Post, let’s create a Repository for the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;The repository contains the various methods for getting the records from the database. It is also used to create a user-defined method to get records/data from the &lt;a href="https://medium.com/hackernoon/top-5-sql-and-database-courses-to-learn-online-48424533ac61" rel="noopener noreferrer"&gt;database&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;create PostRepository.java file and paste the following code :&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Here, we need one custom(user-defined) method to get the user-specific posts. All other methods (e.g. findPostByID,findAllPost) will be provided by default as we extend the JpaRepository interface.

&lt;p&gt;After that, we need to show the latest post at first. So, we have added custom method findAllByOrderByIdDesc . This method will send the posts into reverse order of Id.&lt;/p&gt;

&lt;p&gt;Now, Let’s create a service for performing CRUD operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Service&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The service is used to perform various operations(e.g. CRUD) on the database. The service file is used to write business logic in the code. Nowadays getting data is not enough we need to apply the preprocessing on data. The methods of service class will be useful to extract the data from the database holding specific conditions and rules.&lt;/p&gt;

&lt;p&gt;create a file PostService.java and paste the following code :&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Here, we have created 3 methods to save a Post, get the post of a specific user, and get all the posts.

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;save post method will take a currently logged-in user’s information and the content of the post and save it in the &lt;a href="https://medium.com/hackernoon/top-5-sql-and-database-courses-to-learn-online-48424533ac61" rel="noopener noreferrer"&gt;database&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;get Post of a user method will take a user id of some user whose Posts the current user wants to see.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;get all post method will simply provide the list of all Posts in Reversed order.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Finally, we have created services. Let’s move towards the final step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;A controller is a very important part of &lt;a href="https://medium.com/javarevisited/10-advanced-spring-boot-courses-for-experienced-java-developers-5e57606816bd?source=collection_home---4------0-----------------------" rel="noopener noreferrer"&gt;Spring Boot MVC&lt;/a&gt;. It is used to create API endpoints and interact with users via request and response. It uses the Service that we have created previously to perform the various operation to manipulate the data so that we get all data in the proper format.&lt;/p&gt;

&lt;p&gt;paste the following code on the controller file :&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Here, we have created 4 endpoints addpost, mypost, posts, /{user_id}/posts .

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add Post is the POST method that will accept the content of the user if a user is logged in and verified and store the content in the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;My Post endpoint will show the post of the currently logged-in user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Posts endpoints will not be requiring any authentication as all people can see the posts of other users. It will send all the Posts in response.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The last endpoint /{user_id}/posts is used to get the Posts of the specified users. It will take the user id from the request and pass it to the postService and send posts of the specified user.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Finally, we have completed the implementation of our backend. Let’s test our API endpoints.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2108%2F1%2AhLE3gybpLXAFiLwLBxLW2g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2108%2F1%2AhLE3gybpLXAFiLwLBxLW2g.png" alt="Add Post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2078%2F1%2A0ouYPPtG6AKcVLiDDeDTfg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2078%2F1%2A0ouYPPtG6AKcVLiDDeDTfg.png" alt="My Post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2034%2F1%2AF2Qxr-cyZsDHKd3bK-7zZw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2034%2F1%2AF2Qxr-cyZsDHKd3bK-7zZw.png" alt="Get All Post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2012%2F1%2AeZwTzP2y7hx5i8dUmZ-hYQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2012%2F1%2AeZwTzP2y7hx5i8dUmZ-hYQ.png" alt="Get Post of Specific User"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hurray! It's working.&lt;/p&gt;

&lt;h2&gt;
  
  
  Congratulations
&lt;/h2&gt;

&lt;p&gt;You have learned to create a Post feature in the Backend. Stay tuned for more upcoming features.&lt;/p&gt;

</description>
      <category>facebookclone</category>
      <category>socialmediaapp</category>
      <category>chattingapp</category>
      <category>spring</category>
    </item>
    <item>
      <title>Let’s Place Order and See Order History in E-commerce app using Vue</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 23 Apr 2021 15:36:35 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/let-s-place-order-and-see-order-history-in-e-commerce-app-using-vue-ihn</link>
      <guid>https://dev.to/nilmadhabmondal/let-s-place-order-and-see-order-history-in-e-commerce-app-using-vue-ihn</guid>
      <description>&lt;h3&gt;
  
  
  In this tutorial, we will learn how to display the order history of the user
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2160%2F1%2AteArq6e7QmhUMO84KJSysw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2160%2F1%2AteArq6e7QmhUMO84KJSysw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We are building an e-commerce app from scratch using Vue.js in the frontend and Java with Springboot for the backend. You can check out the first frontend tutorial of this series here.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/_r8dXk0jj7E"&gt;
&lt;/iframe&gt;
&lt;br&gt;
We will be building an order feature which is a continuation of our &lt;a href="https://medium.com/dev-genius/lets-add-a-checkout-feature-in-vue-js-for-our-ecommerce-app-84b5fc2df17a" rel="noopener noreferrer"&gt;previous &lt;/a&gt;tutorial.&lt;br&gt;
&lt;a href="https://medium.com/dev-genius/lets-add-a-checkout-feature-in-vue-js-for-our-ecommerce-app-84b5fc2df17a" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Checkout Feature in Vue.js for Our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the complete code at &lt;a href="https://github.com/webtutsplus/ecommerce-vuejs" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Live Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://infallible-swartz-b50174.netlify.app/" rel="noopener noreferrer"&gt;https://infallible-swartz-b50174.netlify.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3802%2F1%2AoEH9vlHsurqMPqO_W-HOvg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3802%2F1%2AoEH9vlHsurqMPqO_W-HOvg.png" alt="All Orders Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3798%2F1%2A_fWevOfgTJynMfPiX81pgQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3798%2F1%2A_fWevOfgTJynMfPiX81pgQ.png" alt="Order Details Page"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Knowledge of &lt;strong&gt;Vuejs&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt; &lt;strong&gt;—&lt;/strong&gt;open-source (Recommended)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A good browser &lt;strong&gt;—&lt;/strong&gt;(Chrome — recommended)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  API we will be using
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2FNaN%2F1%2AeE9F0umd_l2_IQKc-NLmjQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2FNaN%2F1%2AeE9F0umd_l2_IQKc-NLmjQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For explanation and implementation of these APIs please refer to this tutorial.&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-the-place-order-feature-to-our-e-commerce-app-using-spring-boot-1a16925be0bf" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add the Place Order feature to our E-commerce app using Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AAiQnd9NtIXxS2E_7f_D0eA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AAiQnd9NtIXxS2E_7f_D0eA.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The flow of the tutorial
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Displaying order history&lt;br&gt;
 Displaying details for specific order&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Now let’s begin with coding
&lt;/h2&gt;

&lt;p&gt;So in the checkout &lt;a href="https://medium.com/dev-genius/lets-add-a-checkout-feature-in-vue-js-for-our-ecommerce-app-84b5fc2df17a" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt;, we implemented the Vue component Success in which we call the add order API like this&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
And then we redirect the user to the order component where we display the order history.
&lt;h2&gt;
  
  
  Order Component (displaying order history)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3802%2F1%2AoEH9vlHsurqMPqO_W-HOvg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3802%2F1%2AoEH9vlHsurqMPqO_W-HOvg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So let’s create the Ordercomponent in the src/views/Orders folder and register the route in the index.js file of the src/router folder.&lt;/p&gt;

&lt;p&gt;You may refer to &lt;a href="https://github.com/webtutsplus/ecommerce-vuejs/blob/master/src/router/index.js" rel="noopener noreferrer"&gt;this&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, we declare the data variables to store data from the backend API response.&lt;/p&gt;

&lt;p&gt;orders: to store the response data&lt;/p&gt;

&lt;p&gt;len: to store the number of orders in the user’s order history&lt;/p&gt;

&lt;p&gt;orderList: an array to store the list of orders&lt;/p&gt;

&lt;p&gt;totalCost: to store the total Price of the order&lt;/p&gt;

&lt;p&gt;orderdate: to store the date at which the order was placed&lt;/p&gt;

&lt;p&gt;We need a method that will call the backend API for listing the orders which we implemented in the previous tutorial. So, create a method and call the API using Axios get method.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AVw8JyrAgK3ExvCd6pxraDg.png"&gt;

&lt;p&gt;In the response, we get the created date in the java format but we just need the format like yyyy/mm/dd hence we took the substring and stored it in the orderdate data variable.&lt;/p&gt;

&lt;p&gt;Also, we do not store the details of order items in the order list instead we just store the id of that order.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why do we do this?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The idea is to display the details of that order if and only if the user clicks on that order. So as a route param we pass the id so that we display the items in that order according to the id received through the route parameter.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Now when do we call this method?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As soon as the order component is mounted we call this method.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mounted() {
this.token = localStorage.getItem("token")
this.listOrders()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now in the same component, in the template tag, we write the HTML part.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
Now we display the order history (using the v-if directive) if and only if we do not get the response data as null.

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why will the response data be null?&lt;/em&gt;&lt;/strong&gt; Suppose a user(not logged) tries to fetch the order history, the null token will be passed to the API and hence we won’t get any response data to display.&lt;/p&gt;

&lt;p&gt;If we get a response then we iterate through the orders using the v-for directive. And for each order, we implement a router link that will redirect the user to the details of that order according to the order id passed.&lt;/p&gt;

&lt;p&gt;Refer complete code for this component &lt;a href="https://github.com/webtutsplus/ecommerce-vuejs/blob/master/src/views/Orders/Order.vue" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Order Item component (for displaying the details of a specific order)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3798%2F1%2A_fWevOfgTJynMfPiX81pgQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3798%2F1%2A_fWevOfgTJynMfPiX81pgQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the same folder we are working on, create a Vue component named OrderItem . This component will be rendered when a user clicks on a particular order.&lt;/p&gt;

&lt;p&gt;So firstly register this route like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
path:'/order/:id',
name:'OrderItemView',
component:OrderItemView
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now we require one more component to actually display the products of that order. So in this component, we render that component let’s name it as OrderItems to which we the two props:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;id: this is the same id we passed from the Order component as a route parameter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;baseURL: the URL for our backend API&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We obtain the orderID from the route parameter.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Displaying the order details
&lt;/h2&gt;

&lt;p&gt;Now since we render OrderItems component to display the order details the next step is to implement OrderItems component.&lt;/p&gt;

&lt;p&gt;So in the src/components folder create Order folder and in that create OrderItems Vue component.&lt;/p&gt;

&lt;p&gt;First of all, we will catch the props we received like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;props:[“orderID”,”baseURL”]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now let’s create data variables.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;lengthofOrderItems: number pf,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;orderProducts: store the products of an order&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;products: store the response data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;token: a token of the user&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Now we display the products of the order whose order id is the same as the one we receive as the route parameter.&lt;/p&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;As evident from the above-mentioned code, we call the backend API for listing that specific order by passing the order id to the API URL.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  One important point to be noted here is, we receive the parameter in string datatype but in the response, we have id in integer datatype. Hence we convert the string id into integer id and then start the comparison.
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once we retreive the specific order using the API, we iterate through orderItems array and the product array.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A5nOVy6gER3S_7gxP2HSHhQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A5nOVy6gER3S_7gxP2HSHhQ.png" alt="the response body of get orders method"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3798%2F1%2A_fWevOfgTJynMfPiX81pgQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3798%2F1%2A_fWevOfgTJynMfPiX81pgQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now for displaying the HTML part, we need to loop through the order items array using v-for and then display each specification like image, product name, quantity, the price per unit, the total price of that product.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You have now successfully implemented the feature for displaying the order history and details for a specific order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read All the Articles in this Ecommerce Series
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/lets-develop-an-ecommerce-application-from-scratch-using-java-and-spring-6dfac6ce5a9f?sk=6ea3ba5161a0885d7a4072f70c3015ef" rel="noopener noreferrer"&gt;Let’s Develop an E-Commerce Application From Scratch Using Java and Spring&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javascript-in-plain-english/lets-link-product-with-category-for-our-ecommerce-app-28100657a848?sk=13401554153f82f2dfc748c18bf9870c" rel="noopener noreferrer"&gt;Let’s Link Products With Category for our E-Commerce App&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/how-to-develop-file-upload-service-from-scratch-using-java-and-springboot-3a442f4636d5?sk=d885b2f163887e5e524f90beef31ba43" rel="noopener noreferrer"&gt;Let’s Develop File Upload Service From Scratch Using Java and Spring Boot&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/lets-add-wishlist-feature-for-our-e-commerce-app-using-java-and-spring-boot-1402c0b6f1e8?sk=d2b2f9871ad6c446d63d676eff451445" rel="noopener noreferrer"&gt;Let’s Create a WishList for Our e-Commerce App using Java and Spring Boot&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://javascript.plainenglish.io/lets-create-vue-js-frontend-for-products-in-our-e-commerce-app-14cc8c3459c8?sk=53e033c1ed4dffa268f9b2410bb5ca70" rel="noopener noreferrer"&gt;Let’s Create a Frontend for our eCommerce App with Vue.js&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/webtutsplus/lets-add-products-for-our-e-commerce-app-using-javascript-829f36b8571a?sk=c74f95390911a3e35ecdb7ed5270644b" rel="noopener noreferrer"&gt;Let’s Add Products for our eCommerce App Using JavaScript&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/android-app-for-spring-backend-68f39dca8b72?sk=7f0bf103b62b710f30b9c9606ba44bc0" rel="noopener noreferrer"&gt;Android UI for E-Commerce User Profile Backend&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://javascript.plainenglish.io/lets-add-a-shopping-cart-feature-in-vue-js-for-our-ecommerce-app-ae0cc65374ff" rel="noopener noreferrer"&gt;Lets’ Add a Shopping Cart feature for our E-Commerce App using Vuejs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/lets-add-a-checkout-feature-in-spring-boot-for-our-ecommerce-app-72b12a7f3648" rel="noopener noreferrer"&gt;Let’s add a Checkout feature in Spring Boot for our Ecommerce App&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/dev-genius/lets-add-a-checkout-feature-in-vue-js-for-our-ecommerce-app-84b5fc2df17a" rel="noopener noreferrer"&gt;Let’s add a Checkout Feature in Vue.js for Our Ecommerce App&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/lets-add-the-place-order-feature-to-our-e-commerce-app-using-spring-boot-1a16925be0bf" rel="noopener noreferrer"&gt;Let’s add the Place Order feature to our E-commerce app using Spring Boot&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ecommerce</category>
      <category>frontend</category>
      <category>backend</category>
      <category>vue</category>
    </item>
    <item>
      <title>A Complete Guide on How to Develop an E-Commerce Platform</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 23 Apr 2021 15:34:44 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/a-complete-guide-on-how-to-develop-an-e-commerce-platform-17ia</link>
      <guid>https://dev.to/nilmadhabmondal/a-complete-guide-on-how-to-develop-an-e-commerce-platform-17ia</guid>
      <description>&lt;h2&gt;
  
  
  A Complete Guide on How to Develop an E-Commerce Platform
&lt;/h2&gt;

&lt;p&gt;We will build an Ecommerce Platform from Scratch using Vue.js and Spring Framework&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F7680%2F0%2AMAzqA6vuxXqSdlZn" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F7680%2F0%2AMAzqA6vuxXqSdlZn" alt="Photo by [Mark König](https://unsplash.com/@markkoenig?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this course, you will learn how to build an e-commerce platform from scratch. First, you have to be familiar with &lt;strong&gt;Java&lt;/strong&gt; and &lt;strong&gt;Springboot&lt;/strong&gt;, which we will use to build the backend and &lt;strong&gt;Vuejs&lt;/strong&gt; for the frontend.&lt;/p&gt;

&lt;p&gt;You can test the application &lt;a href="http://remotedevs.org:8000/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live Demo
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Frontend
&lt;/h1&gt;
&lt;h1&gt;
  
  
  &lt;a href="https://github.com/webtutsplus/ecommerce-vuejs" rel="noopener noreferrer"&gt;*https://github.com/webtutsplus/ecommerce-vuejs&lt;/a&gt;*
&lt;/h1&gt;
&lt;h1&gt;
  
  
  &lt;a href="https://simplecoding-ecommerce.netlify.app/" rel="noopener noreferrer"&gt;https://simplecoding-ecommerce.netlify.app/&lt;/a&gt;
&lt;/h1&gt;
&lt;h1&gt;
  
  
  &lt;em&gt;Backend&lt;/em&gt;
&lt;/h1&gt;
&lt;h1&gt;
  
  
  &lt;a href="https://github.com/webtutsplus/ecommerce-backend" rel="noopener noreferrer"&gt;https://github.com/webtutsplus/ecommerce-backend&lt;/a&gt;
&lt;/h1&gt;
&lt;h1&gt;
  
  
  &lt;a href="https://limitless-lake-55070.herokuapp.com/swagger-ui.html" rel="noopener noreferrer"&gt;*https://limitless-lake-55070.herokuapp.com/swagger-ui.html&lt;/a&gt;*
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. Admin Panel: Add Product and Categories
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Every e-commerce app need products organised into categories
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;So now let’s add the products and categories section to our app&lt;/p&gt;

&lt;p&gt;In this tutorial, we will display the products and the categories of various products in our app.&lt;/p&gt;

&lt;p&gt;Clicking on a particular product will show its details and also the options for buying it, adding to the cart, and adding to the wishlist section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2Amvst-MKp0V46vHVhOcYrZA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2Amvst-MKp0V46vHVhOcYrZA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2APWPnjSpx-sWh2FtuzG8psQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2APWPnjSpx-sWh2FtuzG8psQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Backend
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MgOJmWMSTuQ"&gt;
&lt;/iframe&gt;
&lt;a href="https://medium.com/javarevisited/lets-develop-an-e-commerce-application-from-scratch-using-java-and-spring-a921f448a93b" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Develop an E-Commerce Application From Scratch Using Java and Spring&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wh3mDFB7OFg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
you can watch product api’s video here.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/hUXfesLKl88"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;strong&gt;Frontend for Product&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://javascript.plainenglish.io/lets-develop-an-e-commerce-application-from-scratch-using-spring-boot-and-vue-js-aca33bd76517" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Develop an E-Commerce Application From Scratch Using Spring Boot and Vue.js&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/PDDXAztk6xg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;strong&gt;Image upload service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2A4QT6x8_RAuI6EPDj1ZFJbA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2A4QT6x8_RAuI6EPDj1ZFJbA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will develop a file upload service, which will be used for image upload in our e-Commerce App using &lt;a href="https://medium.com/javarevisited/top-10-courses-to-learn-spring-boot-in-2020-best-of-lot-6ffce88a1b6e" rel="noopener noreferrer"&gt;Java Spring Boot&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/how-to-develop-file-upload-service-from-scratch-using-java-and-springboot-3a442f4636d5" rel="noopener noreferrer"&gt;&lt;strong&gt;How to Develop File Upload Service From Scratch Using Java and Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Building Authentication (sign up &amp;amp; sign in)
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will learn how to implement authentication of users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AGb5jayMkZVqbJxciazRvxQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AGb5jayMkZVqbJxciazRvxQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2A7iQgGOZHdKbD2ibLWflx6Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2A7iQgGOZHdKbD2ibLWflx6Q.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/develop-signup-and-login-for-e-commerce-app-using-java-and-spring-boot-651f4aad6293" rel="noopener noreferrer"&gt;&lt;strong&gt;Develop SignUp and Login for E-Commerce App using Java and Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Frontend
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://javascript.plainenglish.io/creating-an-ecommerce-frontend-with-vue-js-c64481a65941" rel="noopener noreferrer"&gt;&lt;strong&gt;Creating an eCommerce Frontend with Vue.js&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Building Front end for Customers&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;After building the admin panel, now we are going to show products to customers.&lt;br&gt;
&lt;a href="https://javascript.plainenglish.io/lets-build-an-e-commerce-app-frontend-with-vue-js-8eb088f421a7" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Build an E-Commerce App Frontend with Vue.js&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Adding a Wishlist Feature
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will implement the feature for saving the products not in the cart but in the wishlist section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AR7tNhueWTZF9Ui9hrxvOtg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AR7tNhueWTZF9Ui9hrxvOtg.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-wishlist-feature-for-our-e-commerce-app-using-java-and-spring-boot-1402c0b6f1e8" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Add WishList Feature for Our e-Commerce App using Java and Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://javascript.plainenglish.io/creating-an-ecommerce-frontend-with-vue-js-71d7fc1ee756" rel="noopener noreferrer"&gt;&lt;strong&gt;Creating an eCommerce Frontend with Vue.js&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Shopping Cart Feature
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will implement the important feature of any e-commerce app i.e shopping cart.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AZTn34nkvWJrsROQXZ6dyKg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AZTn34nkvWJrsROQXZ6dyKg.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-develop-shopping-cart-for-ecommerce-app-8e57a9ab4868" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Develop Shopping Cart for eCommerce App&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://javascript.plainenglish.io/lets-add-a-shopping-cart-feature-in-vue-js-for-our-ecommerce-app-ae0cc65374ff" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Shopping Cart Feature in Vue.js for Our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Checkout using Stripe
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will implement yet another important feature of any e-commerce app i.e. payment method&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2582%2F1%2A4_kZHAnOX9nWof4q4o1MGg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2582%2F1%2A4_kZHAnOX9nWof4q4o1MGg.png" alt="payment page provided by Stripe"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-a-checkout-feature-in-spring-boot-for-our-ecommerce-app-72b12a7f3648" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Checkout feature in Spring Boot for our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/dev-genius/lets-add-a-checkout-feature-in-vue-js-for-our-ecommerce-app-84b5fc2df17a" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Checkout Feature in Vue.js for Our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Place Order and Order History Feature
&lt;/h2&gt;

&lt;p&gt;Next Step, we will implement the feature for placing the order and displaying the order history of a particular user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AAYyrs-qcYovXS2BnzZsmhw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AAYyrs-qcYovXS2BnzZsmhw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2Av9eAP2EFKZsEDXFZKGt48A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2Av9eAP2EFKZsEDXFZKGt48A.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-the-place-order-feature-to-our-e-commerce-app-using-spring-boot-1a16925be0bf" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add the Place Order feature to our E-commerce app using Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/webtutsplus/lets-place-order-and-see-order-history-in-e-commerce-app-using-vuejs-1a8117318df" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Place Order and See Order History in E-commerce app using Vuejs&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  If you are only interested in backend APIs then follow these
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://medium.com/javarevisited/lets-develop-an-ecommerce-application-from-scratch-using-java-and-spring-6dfac6ce5a9f" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s develop an Ecommerce Application from Scratch using Java and Spring&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-wishlist-feature-for-our-e-commerce-app-using-java-and-spring-boot-1402c0b6f1e8" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Add WishList Feature for Our e-Commerce App using Java and Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-develop-shopping-cart-for-ecommerce-app-8e57a9ab4868" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Develop Shopping Cart for eCommerce App&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-a-checkout-feature-in-spring-boot-for-our-ecommerce-app-72b12a7f3648" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Checkout feature in Spring Boot for our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/javarevisited/lets-add-the-place-order-feature-to-our-e-commerce-app-using-spring-boot-1a16925be0bf" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add the Place Order feature to our E-commerce app using Spring Boot&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  For Frontend (Web) tutorials follow these
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://nilmadhab.medium.com/lets-create-vue-js-frontend-for-products-in-our-e-commerce-app-14cc8c3459c8" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Create a Frontend for our eCommerce App with Vue.js&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/webtutsplus/lets-link-product-with-category-for-our-ecommerce-app-28100657a848" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Create A Vue.js E-Commerce App&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/webtutsplus/lets-add-products-for-our-e-commerce-app-using-javascript-829f36b8571a" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Add Products for Our eCommerce App Using JavaScript&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://javascript.plainenglish.io/creating-an-ecommerce-frontend-with-vue-js-71d7fc1ee756" rel="noopener noreferrer"&gt;&lt;strong&gt;Creating an eCommerce Frontend with Vue.js&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://javascript.plainenglish.io/lets-add-a-shopping-cart-feature-in-vue-js-for-our-ecommerce-app-ae0cc65374ff" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Shopping Cart Feature in Vue.js for Our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/dev-genius/lets-add-a-checkout-feature-in-vue-js-for-our-ecommerce-app-84b5fc2df17a" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s add a Checkout Feature in Vue.js for Our Ecommerce App&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  For Android tutorials follow these
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://medium.com/webtutsplus/android-ui-for-e-commerce-user-profile-backend-4053ab122a13" rel="noopener noreferrer"&gt;&lt;strong&gt;Android UI for E-Commerce User Profile backend&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/webtutsplus/lets-add-products-in-android-for-e-commerce-app-b8468e055001" rel="noopener noreferrer"&gt;&lt;strong&gt;Let’s Add Products in Android for E-Commerce App&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ecommerce</category>
      <category>frontend</category>
      <category>backend</category>
      <category>vue</category>
    </item>
    <item>
      <title>Export your Medium Articles to Dev.to in 3 clicks</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Thu, 01 Apr 2021 13:31:47 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/export-your-medium-articles-to-dev-to-in-3-clicks-473h</link>
      <guid>https://dev.to/nilmadhabmondal/export-your-medium-articles-to-dev-to-in-3-clicks-473h</guid>
      <description>&lt;p&gt;A chrome extension that will enable writers to export their Medium articles to the Dev Community with just three clicks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4004%2F1%2AmztygNmubYdQ-DElrdunSA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4004%2F1%2AmztygNmubYdQ-DElrdunSA.png" alt="Photo by Author"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are a writer and publish your articles regularly on Medium and Dev Community, you must already know that both the platforms have different formatting syntax for writing articles. While Dev Community uses &lt;strong&gt;markdown&lt;/strong&gt; which is a standard format and very popular in the open-source community, Medium has its own format for styling your articles. &lt;/p&gt;

&lt;p&gt;If you want to publish the same article on both the platforms, the only way to do it is to write the article twice — once for Dev Community and once for Medium. This is cumbersome, requires the writer to have knowledge of both Markdown &amp;amp; Medium’s formatting syntax and takes considerable time. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Medium-to-Dev Chrome Extension&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As the name suggests, this Chrome Extension can convert articles from Medium’s Styling format to Markdown. Moreover, the extension is also capable of creating a draft on the Dev Community using the generated Markdown. The following video illustrates: -&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/L0RkBtVsZHI"&gt;
&lt;/iframe&gt;
&lt;br&gt;
In this tutorial, we will create this extension. If you want to use the extension before we begin coding, you can download it from the Chrome Web Store. The Extension is available on the Chrome Web Store: -&lt;br&gt;
&lt;a href="https://chrome.google.com/webstore/detail/medium-to-dev/ebbpgnlogjlnchmlfiagmgifdcafpbef" rel="noopener noreferrer"&gt;&lt;strong&gt;Medium to Dev&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to use the Extension
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add the extension to Google Chrome using the above-mentioned link on Chrome Web Store. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open &lt;a href="https://www.dev.to"&gt;Dev Community&lt;/a&gt;’s website and make sure that you are logged in.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, open an article on Medium that you have published. You can also open a saved draft.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on &lt;em&gt;Extensions *icon located on the right side of *Address Bar&lt;/em&gt;. Then, click on &lt;em&gt;Medium to Dev&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, a pop-up window will open. Once it is loaded, you can see the markdown version of your current article. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the button *Copy to ClipBoard *to copy the markdown.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on &lt;em&gt;Open in Dev.to&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A new tab will open. Once it is finished loading, you will be able to see the draft for your Dev Article containing the markdown of your current article.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5724%2F1%2AZ9WRmtTPR0NNdeOXJKe58A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5724%2F1%2AZ9WRmtTPR0NNdeOXJKe58A.png" alt="open your article and click on the chrome extension logo "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3236%2F1%2ApJxEhqEqIbx__nQKBAtlog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3236%2F1%2ApJxEhqEqIbx__nQKBAtlog.png" alt="Click on **Copy to Clipboard **button and then Click open to Dev.to button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4752%2F1%2AReW6nyTznPXEPoW3KnIE5A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4752%2F1%2AReW6nyTznPXEPoW3KnIE5A.png" alt="The markdown will be copied automatically to Dev.to as a new Draft"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4628%2F1%2AmgsYGkJqIquhBeKTKthqfg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4628%2F1%2AmgsYGkJqIquhBeKTKthqfg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5504%2F1%2AS4ydjfi3Gk0DhfC2yU2vng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5504%2F1%2AS4ydjfi3Gk0DhfC2yU2vng.png" alt="Click on Preview or Publish and Volia your article is copied "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supports&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The github gists is supported which is very useful for developers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Youtube Videos are supported.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Future Enhancements coming soon&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Exporting from Friend Link&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some diagrams might not be working, adding support for those. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you find any bugs or enhancements, feel free to comment here or in chrome dashboard page. &lt;/p&gt;

&lt;p&gt;In the next tutorial, we will discuss how we developed the extension and deep dive into the Javascript code. &lt;/p&gt;

</description>
      <category>writing</category>
      <category>webdev</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Let’s Build a Robust Social Login Using Spring Boot, Vue.js and Firebase</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Fri, 26 Mar 2021 16:30:34 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/let-s-build-a-robust-social-login-using-spring-boot-vue-js-and-firebase-2fmc</link>
      <guid>https://dev.to/nilmadhabmondal/let-s-build-a-robust-social-login-using-spring-boot-vue-js-and-firebase-2fmc</guid>
      <description>&lt;p&gt;We will build a Vue.js client to login using Github/Google with Firebase and build a stateless backend using spring boot&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KpHLuMcA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/12000/0%2An3qrb2HHI5AzVxf3" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KpHLuMcA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/12000/0%2An3qrb2HHI5AzVxf3" alt="Photo by [Nubelson Fernandes](https://unsplash.com/@nubelsondev?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No one likes to use passwords to login for individual sites these days. Social Login using Github, Google, Facebook are the most preferred ways to build modern apps.&lt;/p&gt;

&lt;p&gt;Implementing them is a bit tricky, as you will come across a lot of concepts and jargons, like&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;OAuth 2.0&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open ID connect&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Delegated Authorization&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Id token&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refresh token&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  The goal is simple, have a front end client like Vue.js and stateless backend using JWT in &lt;a href="https://medium.com/javarevisited/top-10-courses-to-learn-spring-boot-in-2020-best-of-lot-6ffce88a1b6e"&gt;Spring Boot &lt;/a&gt;and users can login seamlessly using one of social provider without ever worrying about password.
&lt;/h1&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

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

&lt;h2&gt;
  
  
  Architecture Diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YOPhdjvi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2700/1%2AikvhJwD3shM01jxUsBj_fw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YOPhdjvi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2700/1%2AikvhJwD3shM01jxUsBj_fw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;From the frontend, we connect to the backend via &lt;a href="https://medium.com/javarevisited/why-frontend-developers-should-learn-firebase-16ff7f7150de"&gt;firebase &lt;/a&gt;SDK and this allows us to communicate with all of the firebase &lt;strong&gt;services&lt;/strong&gt; that we need from the frontend.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user &lt;strong&gt;credentials&lt;/strong&gt; are captured via the login/signup form and then are sent securely to the server via a login or sign-up method provided by firebase SDK then on the server firebase invalidates these credentials and it sends back an &lt;strong&gt;authentication token&lt;/strong&gt; to the client so then we can access the data in the frontend from this token such as name, email, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now we pass this token as a &lt;strong&gt;header&lt;/strong&gt; to the &lt;strong&gt;backend API&lt;/strong&gt;. So, when we hit the firebase from the spring by the token the firebase gives us the user details (like name, email, uid, URL of the picture, etc) according to the token received, and then the user details are saved in the &lt;a href="https://medium.com/hackernoon/top-5-sql-and-database-courses-to-learn-online-48424533ac61"&gt;&lt;strong&gt;database&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The advantage here is the server is &lt;strong&gt;stateless&lt;/strong&gt;, so we do not have to handle &lt;strong&gt;sessions, cookies&lt;/strong&gt; instead we just get the &lt;strong&gt;token&lt;/strong&gt; from firebase which handles the authentication.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Luckily &lt;strong&gt;Firebase&lt;/strong&gt; has a built-in system to integrate it, so we can focus on building our cool apps without worrying about Auth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/pawFCF0bf0w"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r-bECrRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2088/1%2ApSE_DT02vBnYcQXmMKGIKw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r-bECrRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2088/1%2ApSE_DT02vBnYcQXmMKGIKw.png" alt="Options of Social Integration by Firebase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I found two excellent tutorials in medium, which I am going to use for my use case.&lt;br&gt;
&lt;a href="https://medium.com/@anas.mammeri/vue-2-firebase-how-to-add-firebase-social-sign-in-into-your-vue-application-21f341bbf1b"&gt;&lt;strong&gt;Vue 2 + Firebase: How to add Firebase Social Sign-In into your Vue application&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/@purikunal22/securing-springboot-api-using-firebase-authentication-16d72dd250cc"&gt;&lt;strong&gt;Securing SpringBoot API using Firebase Authentication&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: Create a firebase account&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We have to create a firebase account and we will allow GitHub login&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bP_AodZY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3928/1%2Ay1sZ2BICpoQP2iIEpEBHbQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bP_AodZY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3928/1%2Ay1sZ2BICpoQP2iIEpEBHbQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2: Create a Github OAuth app
&lt;/h2&gt;

&lt;p&gt;Enter the client id, secret of the Github app into the firebase above, and use the callback URL of a firebase in GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S9R9QvB---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4148/1%2AYMz9r1YcTZrdh4h6Pu5xeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S9R9QvB---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4148/1%2AYMz9r1YcTZrdh4h6Pu5xeg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 3: Login using Firebase social (Front-end)
&lt;/h2&gt;
&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qv3iCf0A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AYSCBQ81cZe3fLXahmgCaQw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qv3iCf0A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AYSCBQ81cZe3fLXahmgCaQw.png" alt="Vue Project"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Creating routes
&lt;/h2&gt;

&lt;p&gt;In the source directory, create a folder named router, and in that create a JavaScript file that will handle different routes.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  2.Implementing Social Login method using Firebase
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YVbosJ2m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3774/1%2ArW1auYKwupJK8B42erS9mw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YVbosJ2m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3774/1%2ArW1auYKwupJK8B42erS9mw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8IGs58vU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AbkThCSqqH07dGn9QQB-8NA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8IGs58vU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AbkThCSqqH07dGn9QQB-8NA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this step, we will obtain the credentials of the user through firebase Github login functionality and then firebase will send us the id token for that user.&lt;/p&gt;

&lt;p&gt;Then we pass this id token to the backend API so that firebase can authenticate the user to view the features of our application (the features that are only restricted to logged-in users).&lt;/p&gt;

&lt;p&gt;We will make a button for Github login and clicking the button will trigger the following function.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;first we login by firebase.auth().signInWithPopup(provider)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We retrieve the Idtoken from firebase and pass it to spring boot backend in the header, where we will save the User.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So in the source directory of the vue project create a views folder and in that folder create a Vue component called Login.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
After receiving the token we then pass it as a header to the backend API.So we passed the token as a parameter to the saveUsermethod which will call the backend API. Now create a JavaScript file named helper.js which will contain the method saveUser.&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Create private endpoints in Spring boot (back-end)&lt;/strong&gt;
&lt;/h2&gt;

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5zX3y6OC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2Ar9ocX4stQeX8MwU3hekD8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5zX3y6OC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2Ar9ocX4stQeX8MwU3hekD8w.png" alt="Spring Boot Project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We configure the &lt;a href="https://medium.com/javarevisited/10-best-online-courses-to-learn-spring-framework-in-2020-f7f73599c2fd"&gt;Spring backend&lt;/a&gt; in such a way that, when we get the id token from the frontend, we decode the token and get the user information from the firebase. You can read more about it &lt;a href="https://medium.com/@purikunal22/securing-springboot-api-using-firebase-authentication-16d72dd250cc"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we get the principal user, we can save the user in our database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model
&lt;/h2&gt;

&lt;p&gt;Since we need to store the user in the &lt;a href="https://medium.com/javarevisited/7-free-courses-to-learn-database-and-sql-for-programmers-and-data-scientist-e7ae19514ed2"&gt;database &lt;/a&gt;we create a user model in the model package.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Create a repository package and in that create an interface named UserRepository. To use the crud methods of the JPA repository we need to implement a user repository that extends the &lt;a href="https://medium.com/javarevisited/top-5-books-to-learn-hibernate-for-java-developers-b2cb4b16ccd6?source=---------14------------------"&gt;JPA&lt;/a&gt; repository.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Service
&lt;/h2&gt;

&lt;p&gt;Create a service package and in that create a class UserService which will contain the business logic.&lt;/p&gt;

&lt;p&gt;We implement the methods for saving the user in the database and fetching the user by email and fetching all the users from the &lt;a href="https://medium.com/javarevisited/top-5-courses-to-learn-mysql-in-2020-4ffada70656f"&gt;database&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;Create a controller package and in that create two classes one for handling public endpoints and the other for private endpoints.&lt;/p&gt;

&lt;p&gt;The public endpoint will contain API for fetching all the users.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
The private endpoint will contain the API for fetching the user details and saving the user.

&lt;p&gt;When the method saveUserInfois called from frontend it receives id token from the header and through that token firebase returns the information of that user and hence we save in the database.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Congratulations !!!
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;You have successfully created social login (GitHub) feature using Vuejs, Spring Boot, and firebase.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>vue</category>
      <category>springboot</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Let’s add the Place Order feature to our E-commerce app using Spring Boot</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Tue, 23 Mar 2021 15:59:51 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/let-s-add-the-place-order-feature-to-our-e-commerce-app-using-spring-boot-4lfj</link>
      <guid>https://dev.to/nilmadhabmondal/let-s-add-the-place-order-feature-to-our-e-commerce-app-using-spring-boot-4lfj</guid>
      <description>&lt;h2&gt;
  
  
  Let’s add the Place Order feature to our E-commerce app using Spring Boot
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will learn how to create an order and display the order history of the user&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2106%2F1%2AhcPAb0W2Ki424RtZhKKPVw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2106%2F1%2AhcPAb0W2Ki424RtZhKKPVw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We are building an e-commerce app from scratch using Vue.js in the frontend and Java with Spring boot for the backend. You can check out the first front-end tutorial of this series here.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/javarevisited/lets-develop-an-ecommerce-application-from-scratch-using-java-and-spring-6dfac6ce5a9f" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A88%3A88%2F1%2AhNjwft_dNBxvTr6g6TOVGg.jpeg" alt="Nil Madhab"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/javarevisited/lets-develop-an-ecommerce-application-from-scratch-using-java-and-spring-6dfac6ce5a9f" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Let’s Develop an E-Commerce Application From Scratch Using Java and Spring | by Nil Madhab | Javarevisited | Medium&lt;/h2&gt;
      &lt;h3&gt;Nil Madhab ・ &lt;time&gt;Jun 10, 2022&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Placing the order is an important feature for an e-commerce app that allows users to order the products of their choice.&lt;/p&gt;

&lt;p&gt;We will first develop the backend API using Spring Boot and in the next tutorial, we will use this API for the frontend part of our e-commerce website.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Refer the &lt;a href="https://medium.com/javarevisited/lets-add-a-checkout-feature-in-spring-boot-for-our-ecommerce-app-72b12a7f3648?sk=b983c7f510e170a9bf7b4a60a644f1ea" rel="noopener noreferrer"&gt;tutorial &lt;/a&gt;where we implemented the checkout feature here for the backend part
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Live Demo
&lt;/h2&gt;

&lt;p&gt;You can test the API at the following swagger link. You will find the cart API in order-controllersection(Run the code in your local first)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:8080/api/swagger-ui.html#/" rel="noopener noreferrer"&gt;&lt;strong&gt;Swagger API&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the complete code at &lt;a href="https://github.com/webtutsplus/ecommerce-backend" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Knowledge of Java, &lt;a href="https://medium.com/javarevisited/my-favorite-courses-to-learn-object-oriented-programming-and-design-in-2019-197bab351733" rel="noopener noreferrer"&gt;OOP &lt;/a&gt;&amp;amp; &lt;a href="https://medium.com/javarevisited/top-10-courses-to-learn-spring-boot-in-2020-best-of-lot-6ffce88a1b6e" rel="noopener noreferrer"&gt;Spring Boot Framework&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Java Development Kit (JDK)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.jetbrains.com/idea/download/" rel="noopener noreferrer"&gt;IntelliJ IDEA Ultimate&lt;/a&gt; — open-source (Recommended)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/javarevisited/top-5-courses-to-learn-mysql-in-2020-4ffada70656f" rel="noopener noreferrer"&gt;MySQL&lt;/a&gt;/MariaDB Database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A good browser (Chrome — recommended)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A7VGLZQj-6tGFBc3CDjw2lw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A7VGLZQj-6tGFBc3CDjw2lw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AlYJwH_lXc9A107IxZcc00w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AlYJwH_lXc9A107IxZcc00w.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Preview of the API we will be building
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AeE9F0umd_l2_IQKc-NLmjQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AeE9F0umd_l2_IQKc-NLmjQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;placeOrder(/order/add)&lt;/strong&gt; : This is a post method that is responsible for saving the order of the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2122%2F1%2AuAAfvHCI6QH4HijfwT33LA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2122%2F1%2AuAAfvHCI6QH4HijfwT33LA.png" alt="Post body of the method"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getAllOrders(/order/)&lt;/strong&gt;: This is a get method that returns the list of all the orders of a particular user. Therefore it requires only the token of the user as a parameter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Axg-Bcoj0yeImWguXXBBvQw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Axg-Bcoj0yeImWguXXBBvQw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The flow of the tutorial
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Table/Model design
&lt;/h1&gt;
&lt;h1&gt;
  
  
  Create Repository
&lt;/h1&gt;
&lt;h1&gt;
  
  
  Implement &lt;a href="https://javarevisited.blogspot.com/2013/01/data-access-object-dao-design-pattern-java-tutorial-example.html#axzz5b2noKDk3" rel="noopener noreferrer"&gt;Dto&lt;/a&gt;
&lt;/h1&gt;
&lt;h1&gt;
  
  
  Implement Service class (Business logic)
&lt;/h1&gt;
&lt;h1&gt;
  
  
  Implement Controller class (Building APIs)
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Table Design
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Model
&lt;/h3&gt;

&lt;p&gt;Before we begin to code, we must invest some time thinking about the model/table design. So we require two tables which will be linked with each other. So in the existing modelpackage, create two files Order.java and OrderItem.java .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first table/model&lt;/strong&gt; (we name it as order)will contain attributes such as id(primary key), user_id(foreign key), created_date, session-id (the payment session-id we generated), and the total_price .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;User id we will be fetching from the users table.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you are wondering about the session id, please refer to &lt;a href="https://medium.com/javarevisited/lets-add-a-checkout-feature-in-spring-boot-for-our-ecommerce-app-72b12a7f3648?sk=b983c7f510e170a9bf7b4a60a644f1ea" rel="noopener noreferrer"&gt;this tutorial&lt;/a&gt; where we have explained the checkout session.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The second table/model&lt;/strong&gt; (we name it as orderitems) will actually contain the products that are present in a particular order. There we need to link these two tables. So the &lt;a href="https://www.java67.com/2015/12/difference-between-primary-and-foreign.html" rel="noopener noreferrer"&gt;primary key&lt;/a&gt; i.e. idfrom the order table will be used as a foreign key in the orderitems table. So the attributes of the orderitems table will be order_item_id, created_date, price, product_id(foreign key), quantity, order_id(foreign key).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Product id we will be obtained from the products table.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Order model
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Table relationship&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;order table and orderitems table has a relation type of one to many, i.e. one row(entry) in order table is related to multiple rows(items of that particular order) in the orderitems table.&lt;/p&gt;

&lt;p&gt;Similarly, order and user tables have a relation type of many to one i.e. multiple orders (entries/rows) are related to a single user (row/entry), because a user may have multiple orders.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Order items model
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Table relationship&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The ordertable we created just now and this orderitems table has a relation type of many to one since multiple items (products) can be in relation with a particular order.&lt;/p&gt;

&lt;p&gt;products table and the orderitems table has a relation type of one to one since a row(item) in the orderitems table is related to only one row(item) in the products table.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Create two java files in the existing repository package OrderRespository.java and OrderItemsRespository.java .&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Firstly we create repository interface for the order table(OrderRespository.java).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Creating CRUD methods manually means writing a lot of boilerplate code unless you let the JPARepository interface carry about routine implementations for you. So, we will extend the JPARepository and create the interface CartRepository.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Extending JPARepository will automatically create and implement methods for the basic CRUD operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We will define a method findAllByUserIdOrderByCreatedDateDesc to fetch the orders list of a user and then order the list by created the date of each entry in the order table. The implementation of this method will be managed automatically by the JPARepository .&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Similarly we create repository interface for the orderitems table(OrderItemsRespository.java).&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

We do not declare any method here but instead, we will use one method in the service class later.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DTO
&lt;/h2&gt;

&lt;p&gt;In the dto package create a package named order and in which create 3 files orderDto.java , OrderItemsDto.java and placeOrderDto.java .&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;We create OrderDto for as a dummy object for the Order model with two fields id and userId .&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Similarly we create OrderItemsDto
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

Currently, we won't be using this DTO but for future use or modifications, we keep this dto ready.&lt;/li&gt;
&lt;li&gt;Now in the PlaceOrderDto we declare three fields id, userId, and the totalCostof the order. This dto will be used to save the order in the order table.
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

## Service&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;Now, let’s implement the Service class to interact with the order and orderitems table. In the OrderRepositoryinterface, we defined the methods to interact with the &lt;a href="https://medium.com/hackernoon/top-5-sql-and-database-courses-to-learn-online-48424533ac61" rel="noopener noreferrer"&gt;database&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the Service class, we will call these methods and implement the so-called business logic. We will create methods for adding the order, fetching all orders of a user. Inside these methods, we will call the methods defined in the OrderRepositoryinterface.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, let’s implement the orderitems service class. In this class, we implement one method in order to save an item/product in a particular order.
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Now let’s create the order service class which will contain the logic for placing the order and fetching the order details.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;placeOrder: This method is used to set the PlaceOrderDto and it receives the id of the order from the saveOrder method. This id is returned from the saveOrder method because we need this id as an attribute in the orderItems table. Also using the object of cartService class we fetch the items in the cart and then save those in the orderitems table using the method in the orderItemsService class. And once the order is placed we delete the cart i.e. remove the items in the cart.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
saveOrder: This method first creates the order object and then using the method of orderRepository it saves the order in the order table and returns the id which we used in the previous method.

&lt;p&gt;listOrders : This method will take the user id as a parameter and then return a list of all the orders from the order table corresponding to that user id.&lt;/p&gt;
&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Here we will build our APIs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the controller package creates a file OrderController.java and annotate the class with &lt;a href="https://javarevisited.blogspot.com/2017/08/difference-between-restcontroller-and-controller-annotations-spring-mvc-rest.html#ixzz6OYNB9oii" rel="noopener noreferrer"&gt;RestController annotation&lt;/a&gt;. In this OrderController class, we will use the methods we defined in the orderService class.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;So firstly we will implement the API for saving the order. Create a method placeOrder that accepts token and the session Id as parameters.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This method which throws an exception&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;if the invalid user(not logged in) user tries to place the order&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;if the user (valid) tries to place the order of the product which does not exist in the products table.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F1%2AfEViCrtG6PBPPc7_HoCUUQ.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F1%2AfEViCrtG6PBPPc7_HoCUUQ.gif"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Since we added the order to the table, now we build an API to fetch the orders of the user. This method throws an exception if an invalid user tries to fetch the order history.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Anirp8OQ318T89ArOwrXwig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2Anirp8OQ318T89ArOwrXwig.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AUf0ZuWg5BSB8CCOyKYDOPQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AUf0ZuWg5BSB8CCOyKYDOPQ.png" alt="the response body for fetching the orders of a user method"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Congratulations!!!
&lt;/h2&gt;

&lt;p&gt;We have now successfully added the order feature to our e-commerce app using Spring Boot. In the next tutorial we will implement the front end part using these APIs using Vuejs, so stay tuned!&lt;/p&gt;

</description>
      <category>ecommerce</category>
      <category>springboot</category>
      <category>java</category>
    </item>
    <item>
      <title>The New Way of Using Linux Seamlessly in Windows by WSL</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Tue, 23 Mar 2021 15:17:20 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/the-new-way-of-using-linux-seamlessly-in-windows-by-wsl-1ng1</link>
      <guid>https://dev.to/nilmadhabmondal/the-new-way-of-using-linux-seamlessly-in-windows-by-wsl-1ng1</guid>
      <description>&lt;p&gt;Run Linux Kernel inside Windows without third-party softwares like VMWare, Virtual Box etc by &lt;strong&gt;Windows Subsytem for Linux&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4000%2F1%2AY9EGVV-pluZXc7mWzc2jxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4000%2F1%2AY9EGVV-pluZXc7mWzc2jxg.png" alt="Image by Author"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a very popular notion that Linux is the best OS for software development but Windows is more easy and comfortable to use. That must have made many of you to wonder if there were some way to &lt;strong&gt;run Linux Kernel below Windows GUI&lt;/strong&gt;. If we could achieve this, we would get &lt;strong&gt;BEST of Windows and Linux in a single OS.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Turns out that there is one way to do this — &lt;strong&gt;WSL (Windows Subsytem for Linux)&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How is WSL different than Dual Booting OR running a virtualization software ?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;WSL vs Dual Booting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Dual Booting means installing multiple operating systems on a single computer, and being able to choose which one to boot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This means that you &lt;strong&gt;CANNOT&lt;/strong&gt; run both the OS at the same time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But if you use WSL, you can use &lt;strong&gt;both the OS simultaneously&lt;/strong&gt; without the need to switch the OS.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;WSL vs Virtualization Software&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There are many virtualization software available in the market today. Some of the most popular ones are Virtual Box, VMWare etc. Some of you may have even used one of them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When you use VMWare or Virtual Box, you can run Linux (with GUI) inside Windows but &lt;strong&gt;it takes a lot of time to load&lt;/strong&gt;. Also, if you need to access files stored in the main OS or internet from within the Virtual Machine (Guest OS), you &lt;strong&gt;need to install multiple drivers&lt;/strong&gt; which makes it a very complex process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;WSL2 solves all of this. It takes &lt;strong&gt;less than a second&lt;/strong&gt; &lt;strong&gt;to load&lt;/strong&gt; the Linux Kernel. The process is same as opening CMD or PowerShell in Windows. Moreover, the file mounting/sharing, command running, and networking between your Windows desktop environment and the WSL2 environment is seamless and nearly instant on launch. You &lt;strong&gt;do not have to manage this environment&lt;/strong&gt; — it will update alongside Windows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Moreover, &lt;strong&gt;if you use WSL, you can use programs installed on Windows from the Linux kernel&lt;/strong&gt;. One such example is VS Code. You can execute the command *code file_name *from the Linux Kernel to open a file in VS Code (which is installed in Windows).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How WSL looks ?
&lt;/h2&gt;

&lt;p&gt;If you are a guy who believes more in seeing stuff rather than reading about that stuff, you can have a look at the photo mentioned below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2ARhKNSqmaA399itcbk0spbA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2ARhKNSqmaA399itcbk0spbA.png" alt="Running Linux using WSL on Windows"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above image, you can see that a linux terminal is running on a windows PC just like Windows PowerShell.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Install WSL?
&lt;/h2&gt;

&lt;p&gt;In this article, we will tell you how to enable WSL2 and &lt;strong&gt;install a Linux Distro of your choice&lt;/strong&gt;. WSL 2 is the latest version of WSL and is even better. To know more, you can visit this Microsoft Docs &lt;a href="https://docs.microsoft.com/en-us/windows/wsl/compare-versions" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To install WSL 2, we will install WSL first and then upgrade to WSL 2.&lt;/p&gt;

&lt;p&gt;There are two options available for installing Windows Subsystem for Linux (WSL):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10#simplified-installation-for-windows-insiders" rel="noopener noreferrer"&gt;Simplified install&lt;/a&gt; (preview)&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Executing the command — wsl --install on a powershell terminal will install WSL without any additional steps. But this command requires that you join the &lt;a href="https://insider.windows.com/getting-started" rel="noopener noreferrer"&gt;Windows Insiders Program&lt;/a&gt; and install a preview build of Windows 10 (OS build 20262 or higher).&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps" rel="noopener noreferrer"&gt;Manual install&lt;/a&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The manual install steps can be used on &lt;strong&gt;any version of Windows 10&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Manually Installing WSL 2
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1 — Enable the Windows Subsystem for Linux
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We must first enable the “Windows Subsystem for Linux” optional feature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run PowerShell as Administrator and execute the following command:&lt;/p&gt;

&lt;p&gt;dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;This command may take anywhere between 40–90 minutes to run&lt;/strong&gt;. Moreover, not much will be output to the terminal when this command is getting executed. Hence, you must wear patience caps when you execute this command :)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do NOT restart the PC at this stage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2 — Check requirements for running WSL 2
&lt;/h3&gt;

&lt;p&gt;To update to WSL 2, you must be running Windows 10.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For x64 systems: Version 1903 or higher, with Build 18362 or higher.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Builds lower than 18362 do not support WSL 2. Use the &lt;a href="https://www.microsoft.com/software-download/windows10" rel="noopener noreferrer"&gt;Windows Update Assistant&lt;/a&gt; to update your version of Windows.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3 — Enable Virtual Machine feature
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Before installing WSL 2, we must enable the Virtual Machine Platform optional feature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run PowerShell as Administrator and execute:&lt;/p&gt;

&lt;p&gt;dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Restart your machine to complete the WSL install and update to WSL 2.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4 — Download the Linux kernel update package
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Download the latest package using the following link — &lt;a href="https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi" rel="noopener noreferrer"&gt;WSL2 Linux kernel update package for x64 machines&lt;/a&gt; . &lt;strong&gt;If you’re using an ARM64 machine, please download the &lt;a href="https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi" rel="noopener noreferrer"&gt;ARM64 package&lt;/a&gt; instead.&lt;/strong&gt; If you’re not sure what kind of machine you have, open Command Prompt or PowerShell and enter: systeminfo | find "System Type".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the update package downloaded in the previous step. (Double-click to run — you will be prompted for elevated permissions, select ‘yes’ to approve this installation.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5 — Set WSL 2 as your default version
&lt;/h3&gt;

&lt;p&gt;Run PowerShell and execute this command to set WSL 2 as the default version when installing a new Linux distribution:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl --set-default-version 2&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Step 6 — Install your Linux distribution of choice&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;Open the Microsoft Store and select your favorite Linux distribution. The following links will open the Microsoft store page for each distribution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9pjn388hp8c9" rel="noopener noreferrer"&gt;Ubuntu 16.04 LTS&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9N9TNGVNDL3Q" rel="noopener noreferrer"&gt;Ubuntu 18.04 LTS&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9n6svws3rx71" rel="noopener noreferrer"&gt;Ubuntu 20.04 LTS&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9NJFZK00FGKV" rel="noopener noreferrer"&gt;openSUSE Leap 15.1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9MZ3D1TRP8T1" rel="noopener noreferrer"&gt;SUSE Linux Enterprise Server 12 SP5&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9PN498VPMF3Z" rel="noopener noreferrer"&gt;SUSE Linux Enterprise Server 15 SP1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9PKR34TNCV07" rel="noopener noreferrer"&gt;Kali Linux&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9MSVKQC78PK6" rel="noopener noreferrer"&gt;Debian GNU/Linux&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9n6gdm4k2hnc" rel="noopener noreferrer"&gt;Fedora Remix for WSL&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9NV1GV1PXZ6P" rel="noopener noreferrer"&gt;Pengwin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9N8LP0X93VCP" rel="noopener noreferrer"&gt;Pengwin Enterprise&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.microsoft.com/store/apps/9p804crf0395" rel="noopener noreferrer"&gt;Alpine WSL&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the distribution’s page is opened on the Windows Store, select Get to install that distribution.&lt;/p&gt;

&lt;p&gt;The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC. All future launches should take less than a second.&lt;/p&gt;

&lt;p&gt;You will then need to &lt;a href="https://docs.microsoft.com/en-us/windows/wsl/user-support" rel="noopener noreferrer"&gt;create a user account and password for your new Linux distribution&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2696%2F0%2AVg0ytkrasTPb4VKj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2696%2F0%2AVg0ytkrasTPb4VKj.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CONGRATULATIONS!
&lt;/h2&gt;

&lt;p&gt;You’ve successfully installed and set up a Linux distribution that is completely integrated with your Windows operating system!&lt;/p&gt;

&lt;p&gt;We would also recommend that &lt;strong&gt;you should install Windows Terminal&lt;/strong&gt;. It is &lt;strong&gt;completely optional&lt;/strong&gt; but would enhance your experience with WSL significantly.&lt;/p&gt;



&lt;p&gt;Windows Terminal &lt;strong&gt;enables multiple tabs&lt;/strong&gt; (quickly switch between multiple Linux command lines, Windows Command Prompt, PowerShell, Azure CLI, etc.), &lt;strong&gt;create custom key bindings&lt;/strong&gt; (shortcut keys for opening or closing tabs, copy+paste, etc.), &lt;strong&gt;use the search feature&lt;/strong&gt;, and &lt;strong&gt;custom themes&lt;/strong&gt; (color schemes, font styles and sizes, background image/blur/transparency).&lt;/p&gt;

&lt;p&gt;You can visit the following &lt;a href="https://docs.microsoft.com/en-us/windows/terminal/" rel="noopener noreferrer"&gt;link&lt;/a&gt; to Learn more about Windows Terminal&lt;/p&gt;

&lt;p&gt;To know how to install Windows Terminal, you can visit this &lt;a href="https://docs.microsoft.com/en-us/windows/terminal/get-started" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>operatingsystem</category>
      <category>windows</category>
      <category>wsl</category>
    </item>
    <item>
      <title>Solve Leetcode Problems and Get Offers From Your Dream Companies||Maximum Points You Can Obtain from Cards</title>
      <dc:creator>Nil Madhab</dc:creator>
      <pubDate>Mon, 22 Mar 2021 12:11:21 +0000</pubDate>
      <link>https://dev.to/nilmadhabmondal/solve-leetcode-problems-and-get-offers-from-your-dream-companies-maximum-points-you-can-obtain-from-cards-n01</link>
      <guid>https://dev.to/nilmadhabmondal/solve-leetcode-problems-and-get-offers-from-your-dream-companies-maximum-points-you-can-obtain-from-cards-n01</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Maximum Points You Can Obtain from Cards&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this series, I am going to solve Leetcode medium problems live with my friends, which you can see on our youtube channel, Today we will do Problem Leetcode: 1423. &lt;strong&gt;Maximum Points You Can Obtain from Cards.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--37eg2mmq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2560/1%2ANnlSQcwN8weJcadNuKuGLg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--37eg2mmq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2560/1%2ANnlSQcwN8weJcadNuKuGLg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A little bit about me, I have offers from &lt;strong&gt;Uber&lt;/strong&gt; &lt;strong&gt;India&lt;/strong&gt; and &lt;strong&gt;Amazon&lt;/strong&gt; &lt;strong&gt;India&lt;/strong&gt; in the past, and I am currently working for &lt;strong&gt;Booking.com&lt;/strong&gt; in Amsterdam.&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation to learn algorithms
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://medium.com/leetcode-simplified/solve-leetcode-problems-and-get-offers-from-your-dream-companies-2786415be0b7"&gt;&lt;strong&gt;Solve Leetcode Problems and Get Offers From Your Dream Companies&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem Statement
&lt;/h2&gt;

&lt;p&gt;There are several cards &lt;strong&gt;arranged in a row&lt;/strong&gt;, and each card has an associated number of points The points are given in the integer array cardPoints.&lt;/p&gt;

&lt;p&gt;In one step, you can take one card from the beginning or from the end of the row. You have to take exactly k cards.&lt;/p&gt;

&lt;p&gt;Your score is the sum of the points of the cards you have taken.&lt;/p&gt;

&lt;p&gt;Given the integer array cardPoints and the integer k, return the &lt;em&gt;maximum score&lt;/em&gt; you can obtain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: cardPoints = [1,2,3,4,5,6,1], k = 3
Output: 12
Explanation: After the first step, your score will always be 1. However, choosing the rightmost card first will maximize your total score. The optimal strategy is to take the three cards on the right, giving a final score of 1 + 6 + 5 = 12.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: cardPoints = [2,2,2], k = 2
Output: 4
Explanation: Regardless of which two cards you take, your score will always be 4.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Example 3:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: cardPoints = [9,7,7,9,7,7,9], k = 7
Output: 55
Explanation: You have to take all the cards. Your score is the sum of points of all cards.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Example 4:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: cardPoints = [1,1000,1], k = 1
Output: 1
Explanation: You cannot take the card in the middle. Your best score is 1.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Example 5:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: cardPoints = [1,79,80,1,1,1,200,1], k = 3
Output: 202
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Youtube Discussion&lt;/strong&gt;
&lt;/h2&gt;

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

&lt;p&gt;We will discuss two approaches, the first one will give &lt;strong&gt;TIME LIMIT EXCEEDED&lt;/strong&gt; and the second one will be accepted.&lt;/p&gt;

&lt;p&gt;According to the question, we can choose a card from either the beginning or the end and we need to repeat this step till we get k cards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Base Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If k is less than 1 then no cards can be chosen&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;i should be always less than j&lt;/li&gt;
&lt;li&gt;If i equal to j and k=1 , then we have to choose i -th card.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Recursion Step:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So for an array from i to j , with k cards to be drawn,&lt;/p&gt;

&lt;p&gt;if we choose the card from the beginning then ar[i]+choose from (i+1) to j&lt;/p&gt;

&lt;p&gt;if we choose the card from the end then ar[j]+choose from (i) to (j-1)&lt;/p&gt;

&lt;p&gt;To avoid the same calculations, we can use dynamic programming.We can store the value for i to j with k cards to be drawn in a dictionary.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
This solution is not that efficient and will give &lt;strong&gt;TIME LIMIT EXCEEDED.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s talk about the optimal solution for this problem. We have to k cards either from the beginning or the end. Therefore we can choose&lt;/p&gt;

&lt;p&gt;0 cards from left and k cards from right&lt;/p&gt;

&lt;p&gt;1 card from left and (k-1) cards from right&lt;/p&gt;

&lt;p&gt;2 cards from left and (k-2) cards from right&lt;/p&gt;

&lt;p&gt;.............&lt;/p&gt;

&lt;p&gt;k cards from left and 0 cards from right&lt;/p&gt;

&lt;p&gt;Therefore, we need to find the maximum of these combinations. To make our calculations simpler, we can store the cumulative sum of first k cards from beginning and end. We can find the maximum for all these combinations ;&lt;/p&gt;

&lt;p&gt;left[i]+right[k-i] for all possible values of i (k is given)&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
The code for this problem can be found in the following repository.&lt;br&gt;
&lt;a href="https://github.com/webtutsplus/LeetCode/tree/main/src/LC1423_MaximumPointsObtainedFromCards"&gt;&lt;strong&gt;webtutsplus/LeetCode&lt;/strong&gt;&lt;/a&gt;

&lt;h2&gt;
  
  
  Thank You for reading and Follow this publication for more LeetCode problems!😃
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://medium.com/leetcode-simplified"&gt;&lt;strong&gt;LeetCode Simplified&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>leetcode</category>
      <category>algorithms</category>
      <category>programming</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
