<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nur Islam on Medium]]></title>
        <description><![CDATA[Stories by Nur Islam on Medium]]></description>
        <link>https://medium.com/@nur_islam?source=rss-f5b45464a760------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7oBRccpCNOpfA-4q4Nq_vw.jpeg</url>
            <title>Stories by Nur Islam on Medium</title>
            <link>https://medium.com/@nur_islam?source=rss-f5b45464a760------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 15:11:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nur_islam/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Go (Golang): Quick Recap before an Interview]]></title>
            <link>https://medium.com/@nur_islam/go-golang-quick-recap-before-an-interview-abbc27cc2ac0?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/abbc27cc2ac0</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Sat, 21 Jan 2023 01:44:49 GMT</pubDate>
            <atom:updated>2023-01-21T18:31:47.328Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0SHKBV6bR0IIovzNDSWpw.png" /><figcaption><a href="https://en.wikipedia.org/wiki/Go_%28programming_language%29">Golang Wikipedia</a></figcaption></figure><p><em>This article is intended to give a quick overview of the fundamentals of Golang (Go), so some prior understanding is required. It is more helpful to go through most things at a glance before an interview.</em></p><p><em>Note: Mostly collected while reading other’s articles on different platforms, books, and through various sources. If you find anything wrong or scope to improve please let me know.</em></p><p>It’s a quick recap so I’ll not be going to describe it broadly here but later I might come up with a detailed explanation and the links to other parts will be updated here.</p><blockquote><em>Don’t forget to show your love and support by liking(clapping) and sharing the post if you find the post interesting to encourage me to write more in the future or put your thought in the comment box.</em></blockquote><p><strong>📚 What is Go?</strong></p><blockquote>Go is statically typed, compiled programming language. Developed by Google. Fast to compile and execute.</blockquote><p><strong>📚 What do you find unique/special or what do you like about Go?</strong></p><blockquote>- Fast</blockquote><blockquote>- Memory usages are very minimal.</blockquote><blockquote>- Concurrent</blockquote><blockquote>- Inlining: Go compiler inlines a function by treating the body of the function as if it were part of the caller. So it eliminates new function call therefore no new stack, register needed.</blockquote><blockquote>- Dead code elimination</blockquote><blockquote>- Goroutines</blockquote><blockquote>- Limited set of features, unlike other languages like javascript where you have multiple features to accomplish the same thing.</blockquote><blockquote>- Well built in garbage collector.</blockquote><blockquote>- No official auto configuration. You can configure the system from the roots therefore you will get the oppotunity to know the system very well.</blockquote><blockquote>- Binaries created for Go are extremely small and can be directly executed as executables, without the need of special memory heavy JVMs as seen in Java based executables.</blockquote><blockquote>- Go has been built and introduces in the era of multi-core processor, whereas most other languages have been built in the era of single core processor.</blockquote><blockquote>- Much more optimized for multi-core workflows comprising of concurrency and mulit-threading.</blockquote><blockquote>- Used by many companies to develop scalable, robust micro-services.</blockquote><p><strong><em>References</em></strong></p><ul><li><a href="https://dave.cheney.net/2014/06/07/five-things-that-make-go-fast">Five things that make go fast</a></li></ul><p><strong>📚 Are there any drawbacks you found in Go?</strong></p><blockquote>The community of Go developers is small compared to other languages like Java, Javascript, C++, Python but It is growing very fast.</blockquote><blockquote>No support for Generics (It is coming soon …)</blockquote><blockquote>No support for conventional exception handling. Go does not support try/catch like features (there is noting like exception in Go, errors in Go is like an object and it can be returned as a value)</blockquote><blockquote>Debugging in Production is very hard if logs are not present at the correct places, since there is no JVM to manage application and heap memory for you.</blockquote><p><strong>📚 Dependency Manager</strong></p><blockquote>- Go modules (Go mod)</blockquote><blockquote>- Go dep</blockquote><p><strong>📚 Frameworks</strong></p><blockquote>- Routing: Go Chi, Mux, Gin</blockquote><blockquote>- Web Framkeworks: Gin, Gorilla, Echo, Net/HTTP</blockquote><p><strong>📚 How can you relate the concept of a thread in Go?</strong></p><blockquote>There is no thread concept in Go, instead Go relies on abstracted threads called ‘go routines and sub-routines’. you can run a concurrent and multi-threaded workflow with just a simple keyword and Go will manage that pool without any manual intervention.</blockquote><p><strong>📚 Concurrency vs Parallelism in Go</strong></p><blockquote>- Concurrency is dealing a lot of thing at the same time and Parallelism is doing a lot of things at the same time.</blockquote><blockquote>- Concurrency ensures multiple tasks are progressing simultaneously and Parallelism allows multiple tasks to be executed simultaneously.</blockquote><blockquote>- Parallelism requires more than one processor or thread, but concurrency does not.</blockquote><p><strong><em>Reference:</em></strong></p><ul><li><a href="http://tutorials.jenkov.com/java-concurrency/concurrency-vs-parallelism.html">Concurrency vs. Parallelism</a></li><li><a href="https://osmh.dev/posts/goroutines-under-the-hood">Goroutine under the hood</a></li></ul><p><strong>📚 What is goroutine?</strong></p><blockquote>- Goroutine is a funciton/method that runs concurrently with other funciton.</blockquote><blockquote>- Goroutine is a lightweight, inexpensive thread managed by the Go runtime.</blockquote><blockquote>- The creation of a goroutine only requires <strong>2KB</strong> memory and They grow by allocating and freeing heap storage as required.</blockquote><blockquote>- If any goroutine in the thread blocks say waiting for user input or any other reason it waits or gets blocked, then another OS thread is created and the remaining goroutines are moved to the new OS thread. All these are taken care of by the runtime.</blockquote><blockquote>- If you don’t stop a goroutine, goroutine will be sleeping but never closed, and will be using your memory forever.</blockquote><blockquote>- Go routine communicates through channels (by exchanging messages)</blockquote><blockquote>IMPORTANT:</blockquote><blockquote>- Even if there are multiple goroutines but this is not the case that each running on their own thread or process.</blockquote><blockquote>- There might be many goroutines running on a single thread, Go runtime dynamically multiplexes goroutines onto threads as needed in order to keep each goroutine running.</blockquote><p><strong><em>Reference</em></strong></p><ul><li><a href="https://golangbot.com/goroutines/">Goroutines, Concurrency, Channel</a></li></ul><p>📚 <strong>Usecase of context.Context for Go routine</strong></p><blockquote>- Can be a usecase for managing goroutine’s communications such as passing cancelation signal, deadlins, etc</blockquote><blockquote>-Using context.WithTimeout( — ) you can bind a lifetime for the a go routine by passsing this as a parameter while starting the go routine</blockquote><blockquote>- This helps to avoid go routine leak</blockquote><p>📚 <strong>Thread vs. Goroutine</strong></p><blockquote>- <strong>Setup and Teardown costs:</strong> Threads have significant setup and teardown costs because it has to request resources from the OS and return it once its done. The workaround to this problem is to maintain a pool of threads. In contrast, goroutines are created and destroyed by the runtime and those operations are pretty cheap. The language doesn’t support manual management of goroutines.</blockquote><blockquote>- <strong>Switching costs:</strong> When a thread blocks, another has to be scheduled in its place. Threads are scheduled preemptively, and during a thread switch, the scheduler needs to save/restore ALL registers, that is, 16 general purpose registers, PC (Program Counter), SP (Stack Pointer), segment registers, 16 XMM registers, FP coprocessor state, 16 AVX registers, all MSRs etc. This is quite significant when there is rapid switching between threads.</blockquote><blockquote><strong>Switching between goroutines only happens at well defined point, when an explicit call is made to the Go routime scheduler</strong>:<br>- Scheduling point<br>- Channel sending &amp; Receiving<br>- go Statement<br>- Blocking syscall<br>- Garbage collection</blockquote><blockquote><strong>Goroutines are scheduled cooperatively and when a switch occurs, only 3 registers need to be saved/restored</strong>:<br>- Program Counter<br>- Stack Pointer<br>- DX<br>The cost is much lower.</blockquote><blockquote>As discussed earlier, the number of goroutines is generally much higher, but that doesn’t make a difference to switching time for two reasons. Only runnable goroutines are considered, blocked ones aren’t. Also, modern schedulers are O(1) complexity, meaning switching time is not affected by the number of choices (threads or goroutines)</blockquote><blockquote>- The creation of a goroutine only requires <strong>2KB</strong> memory (while a thread requires <strong>1MB</strong>) and They grow by allocating and freeing heap storage as required.</blockquote><p><strong><em>References</em></strong></p><ul><li><a href="https://blog.nindalf.com/posts/how-goroutines-work/">Thread vs. Goroutine</a></li></ul><p>📚 <strong>Goroutines blocking</strong></p><blockquote>Goroutines are cheap and do not cause the thread on which they are multiplexed to block if they are blocked on -<br>- network input<br>- sleeping<br>- channel operations or<br>- blocking on primitives in the sync package.<br>Even if tens of thousands of goroutines have been spawned, it’s not a waste of system resources if most of them are blocked on one of these since the runtime schedules another goroutine instead.</blockquote><blockquote>In simple terms, goroutines are a lightweight abstraction over threads. A Go programmer does not deal with threads, and similarly the OS is not aware of the existence of goroutines. From the OS’s perspective, a Go program will behave like an event-driven C program.</blockquote><p><strong>📚 What is Channel in Go?</strong></p><blockquote>- Channel provides a powerful way to reason about data flow from one channel to another without locking or going to the critical section.</blockquote><blockquote>-Channels allow goroutines to communicate with one another.</blockquote><blockquote>- Channel allows both sending and receiving values</blockquote><pre>/<em>/ create a new channel</em><br>ch := make(chan string)<br></pre><pre><em>// send a value to channel from a goroutine</em><br>go func() {<br>  ch &lt;- &quot;foobar&quot;<br>}()<br></pre><pre><em>// receive a value from a channel</em><br>go func() {<br>  val := &lt;- ch<br>  fmt.Println(val) // output: foobar<br>}()</pre><p><strong>📚 Closed Channel</strong></p><blockquote><strong>[Closed Channel] ← sending values to a closed channel❌</strong></blockquote><blockquote>A closed channel cannot receive a value. That means sending a value to a closed channel is not allowed.</blockquote><blockquote><strong>[Closed Channel] → geting values from a clsoed channel ✅</strong></blockquote><blockquote>Receiving values from a closed channel is possible. That means we can pull values from an already closed channel that was sent previously (before it gets closed).</blockquote><p>References</p><ul><li><a href="https://dave.cheney.net/2013/04/30/curious-channels">Curious Channel</a> (Closed channel)</li></ul><p><strong><em>More References</em></strong></p><ul><li><a href="https://medium.com/codex/go-concurrency-channels-f19845933c05">Channel, Concurrency, Select, deadlock</a></li><li><a href="https://dave.cheney.net/2013/04/30/curious-channels">Curious channels</a></li></ul><p>📚 <strong>Why Go offers different ways to import packages</strong></p><blockquote>import “package/package_name” :</blockquote><p>This is the most common style of importing any packages in a go project. Any method defined and exported in that package (package/package_name) will be accessible like this: package_name.Abc()</p><blockquote>- import . “package_name”</blockquote><p>Using a Dot (.) after the import keyword while importing a package gives you direct access to any method that is exported in that package like this: Abc(…)</p><p>Note: here you don’t need to use “<strong><em>package_name</em></strong>.Abc(…)” to call the method.</p><blockquote>- import _ “package_name”</blockquote><p>Underscored ( _ ) for importing a package solely for its side effects.</p><p><strong>📚 How to check the type of a variable or an object?</strong></p><pre>package main</pre><pre>import (<br>    &quot;fmt&quot;<br>    &quot;reflect&quot;<br>)</pre><pre>func main() {<br>    abc := 1234<br>    name := &quot;this_is_a_string&quot;</pre><pre>fmt.Println(reflect.TypeOf(abc).String())<br>    fmt.Println(reflect.TypeOf(name).String())<br>}</pre><p>Output</p><pre>int<br>string</pre><p><em>Thanks for reading the article. Your opinion is very important to me. Please show your love and support by liking(clapping) and sharing the post if you find the post interesting to encourage me to write more in the future or put your thought in the comment box.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abbc27cc2ac0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pros & Cons of Lambda function]]></title>
            <link>https://medium.com/@nur_islam/pros-cons-of-lambda-function-ce71ef152c75?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce71ef152c75</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[lambda]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Sat, 15 Oct 2022 23:33:56 GMT</pubDate>
            <atom:updated>2022-10-15T23:45:27.873Z</atom:updated>
            <content:encoded><![CDATA[<p>Quick Recap AWS lambda, some of its pros, cons, and use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*djBovuUveshzYa9_TqPJzg.png" /><figcaption>figure: s3cur3</figcaption></figure><p>This article is more like a cheat sheet for a quick recap. I will try to write more in-depth in another article if needed.</p><p>Based on amazon, AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services.</p><p>It is a computing service that runs code in response to events and automatically manages the computing resources required by that code.</p><p><strong>📚 Pros</strong></p><blockquote>- Easy to maintain</blockquote><blockquote>- Makes development faster by reducing development time</blockquote><blockquote>- No need invest time of thinking about the infrastructure, back-ups since it will be handled by AWS</blockquote><blockquote>- Highly scalable. Depending on the necessity it can scale (each request triggers an independent lambda function)</blockquote><blockquote>- Pay according your uses.</blockquote><p><strong>📚 Cons</strong></p><blockquote>- Cold start requires 100 ms to 2 minutes to start a container.</blockquote><blockquote>- Execution timeout for a lambda function is 15 minutes</blockquote><blockquote>- Function requires a lot of processing/computations should not be an ideal case for lambda function approach</blockquote><blockquote>- AWS keeps the vendor control so no flexibility over vendor</blockquote><blockquote>- Limition of disk space</blockquote><blockquote>- Deployment package around 50 MB and memory range around 3000 MB</blockquote><blockquote>- Request body can contains 128 KB information</blockquote><p><strong>📚 How to overcome some common cons</strong></p><blockquote>- To overcome the cold start, ping them with an fixed interval to keep them alive.</blockquote><blockquote>- To overcome where function requires high processing - Break them into multiple lambda to complete.</blockquote><p><strong>📚 Ideal Use Cases</strong></p><blockquote>- Function with short life span or function does not requires a lot time to exectute completely.</blockquote><blockquote>- For Automation where tasks do not up for 24/7 or have down time</blockquote><blockquote>- Scheduler, cron jobs, etc</blockquote><blockquote>- Sending notifications/updates in real time</blockquote><p>Thanks for reading the post. Feel free to share your thoughts or suggestion. Probably at some point, I might update the post with more information. Follow me to get updates and more posts like this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce71ef152c75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git: How to change your git profile from the command line]]></title>
            <link>https://medium.com/@nur_islam/git-how-to-change-your-git-profile-from-the-command-line-d338f16c7026?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/d338f16c7026</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Sat, 08 Oct 2022 00:20:56 GMT</pubDate>
            <atom:updated>2022-10-08T00:20:56.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bcp0qiED5gDNDMOyE2HmHQ.png" /></figure><p>Here I will show how we can change our git profile for any specific repository.</p><p><strong><em>To check the current email associated with a specific repository:</em></strong></p><ol><li>Go to the repository directory from your terminal.</li><li>Use the following command</li></ol><pre>git config user.email</pre><p><strong><em>To change the profile for a specific repository only:</em></strong></p><ol><li>Open a git bash</li><li>Change your directory for which one you want to update the profile</li><li>Update your email :</li></ol><pre>git config user.email &quot;your_email@abc.com&quot;</pre><p><strong><em>For all repositories (Global change)</em></strong></p><p>If you want to set a profile for all your repository at once, follow the steps below:</p><ol><li>Open git bash</li><li>use the following command</li></ol><pre>git config --global user.email &quot;your_email@abc.com&quot;</pre><p><strong><em>Check if everything is fine</em></strong></p><pre>git config --global user.email</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d338f16c7026" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design a Least Recently Used (LRU) cache in Go (Golang)]]></title>
            <link>https://medium.com/@nur_islam/design-a-least-recently-used-lru-cache-in-go-golang-298d4ce3f3ec?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/298d4ce3f3ec</guid>
            <category><![CDATA[lru-cache]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Sat, 08 Oct 2022 00:14:34 GMT</pubDate>
            <atom:updated>2022-10-08T00:23:06.952Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JROICn7xm8x8S0N2r56cKw.jpeg" /></figure><p>LRU is a cache replacement algorithm used for freeing the memory space for the new data by removing the least recently used data.</p><p>Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.</p><p>Implement the LRU Cache class following :</p><ul><li><strong><em>LRUCache(int capacity)</em></strong> Initialize the LRU cache with positive size capacity.</li><li><strong><em>int get(int key)</em></strong><em> </em>Return the value of the key if the key exists, otherwise return -1.</li><li><strong><em>void put(int key, int value)</em></strong> Update the value of the key if the key exists. Otherwise, add the key-value pair to the cache. If the number of keys exceeds the capacity from this operation, evict the least recently used key.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5052cb7d3708c3731a42e453d7b6dd3b/href">https://medium.com/media/5052cb7d3708c3731a42e453d7b6dd3b/href</a></iframe><p>Thanks for reading the post. Feel free to share your thoughts/suggestion.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=298d4ce3f3ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MERN Stack: A complete MERN guide - Part 3]]></title>
            <link>https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-3-e5b65c490e42?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5b65c490e42</guid>
            <category><![CDATA[mern-stack]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Thu, 29 Sep 2022 22:44:12 GMT</pubDate>
            <atom:updated>2022-09-29T22:44:12.321Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*cNpuzy8MvVOMlfCJrxtc8g.png" /></figure><p>This tutorial is all about the MERN stack. We’ll outline the basics of the MERN stack and demonstrate how to use it by developing a simple CRUD application from scratch.</p><p>To show how the MERN stack works, we’ll first configure the server side by connecting Node.js and Express.js to MongoDB on the backend. Then, we’ll create some APIs. After that, we’ll walk you through building the front end, using React to build our user interfaces. Once both are complete, we’ll connect the front end to the back end.</p><p>Meanwhile, we’ll cover the following topics</p><ul><li>Building the frontend</li><li>Setting up Create React App</li><li>Initial project structure</li><li>Frontend tasks and features</li><li>Adding feature components</li><li>Connecting the frontend and backend</li><li>Running the frontend and backend</li><li>Testing our MERN stack app in the browser</li></ul><p>This demo is designed to highlight the MERN setup. The objective is to develop a simple project with the best possible structure so that you can use it as a boilerplate and elevate your MERN stack projects to meet industry standards.</p><h3>Building the frontend</h3><p>So far, so good! Now that we’ve set up our backend, it’s time to transition to the frontend part of this MERN stack tutorial.</p><p>In this section, we’ll use React to build our user interfaces. React is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and other companies.</p><p>We’ll use Create React App to generate our initial file setup. CRA is a comfortable environment for learning React and is the best way to start building applications in React. It offers a modern build setup with no configuration.</p><p>We’ll also use webpack and Babel to bundle our modules and compile our JavaScript, respectively. If you don’t know webpack or Babel well, no problem; you don’t need to install or configure tools like webpack or Babel. They’re preconfigured and hidden so that you can focus on the code. Just create a project, and you’re good to go.</p><p>You’ll also need any version of Node.js greater than 8.10 and any version of npm greater than 5.6 installed on your local development machine.</p><h3>Setting up Create React App</h3><p>Set any directory using a terminal where you want to keep all the files of this project and run the following command to get the initial setup file:</p><pre>$ npx create-react-app my-app</pre><p>You can replace my-app with whatever you&#39;d like to use as your project name. For example, my project name is mern_a_to_z_client, and my command is:</p><pre>$ npx create-react-app mern_a_to_z_client</pre><p>Note: The project name must be in lowercase letters.</p><p>If everything goes right, then you will see something like the following image, where you will find some instructions along with the commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*-fks6cKqnNlCOMPa.png" /></figure><p>Before using any built-in command, we need to go inside the project folder.</p><pre>$ cd mern_a_to_z_client</pre><p>Now that we are in the project directory, we can use those available commands. If you’re using Yarn:</p><pre>$ yarn start</pre><p>Or, if using npm:</p><pre>$ npm start</pre><p>To run the app in development mode, you can use any of the above commands, and you will see the following message in your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/0*kdqegHDXZ74P1xZu.png" /></figure><p>Now open <a href="http://localhost:3000/">http://localhost:3000</a> to view it in the browser. This page will automatically reload if you make changes to the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*hVN9mrSTEaBBs3ak.png" /></figure><h3>Initial project structure</h3><p>Inside the project directory, our initial file structure should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/0*Yy30acwOCb4tEzdb.png" /></figure><h3>Adding Bootstrap and Font Awesome to your React app</h3><p>We have got our initial setup file for the front-end part. Now we can start integrating our back end with our front end. Before that, though, I want to add Bootstrap and Font Awesome’s CDN to our project.</p><p>Open the file called index.html, which is in the public folder mern_a_to_z_client/public/index.html, and replace everything with the following code:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=&quot;utf-8&quot; /&gt;<br>    &lt;link rel=&quot;shortcut icon&quot; href=&quot;%PUBLIC_URL%/favicon.ico&quot; /&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;<br>    &lt;meta name=&quot;theme-color&quot; content=&quot;#000000&quot; /&gt;<br>    &lt;!--<br>      manifest.json provides metadata used when your web app is installed on a<br>      user&#39;s mobile device or desktop. See <a href="https://developers.google.com/web/fundamentals/web-app-manifest/">https://developers.google.com/web/fundamentals/web-app-manifest/</a><br>    --&gt;<br>    &lt;link rel=&quot;manifest&quot; href=&quot;%PUBLIC_URL%/manifest.json&quot; /&gt;<br>    &lt;!--<br>      Notice the use of %PUBLIC_URL% in the tags above.<br>      It will be replaced with the URL of the `public` folder during the build.<br>      Only files inside the `public` folder can be referenced from the HTML.</pre><pre>Unlike &quot;/favicon.ico&quot; or &quot;favicon.ico&quot;, &quot;%PUBLIC_URL%/favicon.ico&quot; will<br>      work correctly both with client-side routing and a non-root public URL.<br>      Learn how to configure a non-root public URL by running `npm run build`.<br>    --&gt;</pre><pre>&lt;!-- bootstrap css cdn --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&quot; integrity=&quot;sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm&quot; crossorigin=&quot;anonymous&quot;&gt;</pre><pre>&lt;!-- fontawesome cdn --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://use.fontawesome.com/releases/v5.2.0/css/all.css&quot; integrity=&quot;sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ&quot; crossorigin=&quot;anonymous&quot;&gt;</pre><pre>&lt;title&gt;MERN A to Z&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;noscript&gt;You need to enable JavaScript to run this app.&lt;/noscript&gt;<br>    &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;<br>    &lt;!--<br>      This HTML file is a template.<br>      If you open it directly in the browser, you will see an empty page.</pre><pre>You can add webfonts, meta tags, or analytics to this file.<br>      The build step will place the bundled scripts into the &lt;body&gt; tag.</pre><pre>To begin the development, run `npm start` or `yarn start`.<br>      To create a production bundle, use `npm run build` or `yarn build`.<br>    --&gt;</pre><pre>&lt;!-- bootstrap JS cdn --&gt;<br>    &lt;script src=&quot;https://code.jquery.com/jquery-3.2.1.slim.min.js&quot; integrity=&quot;sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js&quot; integrity=&quot;sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js&quot; integrity=&quot;sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;</pre><pre>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Frontend tasks and features</h3><p>We will work with five different features:</p><ol><li>Add, create or save a new book</li><li>Show all the books we have stored in the database</li><li>Show a single book</li><li>Update a book</li><li>Delete a book</li></ol><h3>Dependencies packages installation</h3><p>Now, use the following command to add some necessary dependencies:</p><pre>$ npm install --save react-router-dom $ npm install --save axios</pre><h3>Why Axios?</h3><p>Axios is a lightweight HTTP client based similar to a Fetch API. Axios is a promise-based async/await library for readable asynchronous code. We can easily integrate with React, and it is effortless to use in any front-end framework.</p><p>We’ll call our APIs through Axios.</p><h3>Package.json file</h3><p>At this point, our package.json file should be similar to this; versions can be similar or different:</p><pre>// MERN_A_to_Z_Client - package.json</pre><pre>{<br>  &quot;name&quot;: &quot;mern_a_to_z_client&quot;,<br>  &quot;version&quot;: &quot;0.1.0&quot;,<br>  &quot;private&quot;: true,<br>  &quot;dependencies&quot;: {<br>    &quot;axios&quot;: &quot;^0.19.0&quot;,<br>    &quot;react&quot;: &quot;^16.8.6&quot;,<br>    &quot;react-dom&quot;: &quot;^16.8.6&quot;,<br>    &quot;react-router-dom&quot;: &quot;^5.0.1&quot;,<br>    &quot;react-scripts&quot;: &quot;3.0.1&quot;<br>  },<br>  &quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;react-scripts start&quot;,<br>    &quot;build&quot;: &quot;react-scripts build&quot;,<br>    &quot;test&quot;: &quot;react-scripts test&quot;,<br>    &quot;eject&quot;: &quot;react-scripts eject&quot;<br>  },<br>  &quot;eslintConfig&quot;: {<br>    &quot;extends&quot;: &quot;react-app&quot;<br>  },<br>  &quot;browserslist&quot;: {<br>    &quot;production&quot;: [<br>      &quot;&gt;0.2%&quot;,<br>      &quot;not dead&quot;,<br>      &quot;not op_mini all&quot;<br>    ],<br>    &quot;development&quot;: [<br>      &quot;last 1 chrome version&quot;,<br>      &quot;last 1 firefox version&quot;,<br>      &quot;last 1 safari version&quot;<br>    ]<br>  }<br>}</pre><h3>Creating the component file</h3><p>Inside the src folder ( mern_a_to_z_client/src/), create another folder called components, and inside it, create five different files:</p><ol><li>CreateBook.js</li><li>ShowBookList.js</li><li>BookCard.js</li><li>ShowBookDetails.js</li><li>UpdateBookInfo.js</li></ol><p>We will work with these five files a bit later.</p><h3>Setup route</h3><p>Open the folder called App.js inside the src folder ( mern_a_to_z_client/src/App.js), and replace it with the following code:</p><pre>import React, { Component } from &#39;react&#39;;<br>import { BrowserRouter as Router, Route } from &#39;react-router-dom&#39;;<br>import &#39;./App.css&#39;;</pre><pre>import CreateBook from &#39;./components/CreateBook&#39;;<br>import ShowBookList from &#39;./components/ShowBookList&#39;;<br>import ShowBookDetails from &#39;./components/ShowBookDetails&#39;;<br>import UpdateBookInfo from &#39;./components/UpdateBookInfo&#39;;</pre><pre>class App extends Component {<br>  render() {<br>    return (<br>      &lt;Router&gt;<br>        &lt;div&gt;<br>          &lt;Route exact path=&#39;/&#39; component={ShowBookList} /&gt;<br>          &lt;Route path=&#39;/create-book&#39; component={CreateBook} /&gt;<br>          &lt;Route path=&#39;/edit-book/:id&#39; component={UpdateBookInfo} /&gt;<br>          &lt;Route path=&#39;/show-book/:id&#39; component={ShowBookDetails} /&gt;<br>        &lt;/div&gt;<br>      &lt;/Router&gt;<br>    );<br>  }<br>}</pre><pre>export default App;</pre><p>Here, we define all the routes. For a specific path definition, its corresponding component will be rendered. We have not implemented these files/components yet — just completed the path setup.</p><h3>Updating the CSS file</h3><p>Update a CSS file called App.css in the src folder with the following code:</p><pre>.App {<br>  text-align: center;<br>}</pre><pre>.App-logo {<br>  animation: App-logo-spin infinite 20s linear;<br>  height: 40vmin;<br>  pointer-events: none;<br>}</pre><pre>.App-header {<br>  background-color: #282c34;<br>  min-height: 100vh;<br>  display: flex;<br>  flex-direction: column;<br>  align-items: center;<br>  justify-content: center;<br>  font-size: calc(10px + 2vmin);<br>  color: white;<br>}</pre><pre>.App-link {<br>  color: #61dafb;<br>}</pre><pre>@keyframes App-logo-spin {<br>  from {<br>    transform: rotate(0deg);<br>  }<br>  to {<br>    transform: rotate(360deg);<br>  }<br>}</pre><pre>.CreateBook {<br>  background-color: #2c3e50;<br>  min-height: 100vh;<br>  color: white;<br>}</pre><pre>.ShowBookDetails {<br>  background-color: #2c3e50;<br>  min-height: 100vh;<br>  color: white;<br>}</pre><pre>.UpdateBookInfo {<br>  background-color: #2c3e50;<br>  min-height: 100vh;<br>  color: white;<br>}</pre><pre>.ShowBookList {<br>  background-color: #2c3e50;<br>  height: 100%;<br>  width: 100%;<br>  min-height: 100vh;<br>  min-width: 100px;<br>  color: white;<br>}</pre><pre>/* BookList Styles */<br>.list {<br>  display: grid;<br>  margin: 20px 0 50px 0;<br>  grid-template-columns: repeat(4, 1fr);<br>  grid-auto-rows: 1fr;<br>  grid-gap: 2em;<br>}</pre><pre>.card-container {<br>  width: 250px;<br>  border: 1px solid rgba(0,0,.125);<br>  margin: 0 auto;<br>  border-radius: 5px;<br>  overflow: hidden;<br>}</pre><pre>.desc {<br>  height: 130px;<br>  padding: 10px;<br>}</pre><pre>.desc h2 {<br>  font-size: 1em;<br>  font-weight: 400;<br>}</pre><pre>.desc h3, p {<br>  font-weight: 300;<br>}</pre><pre>.desc h3 {<br>  color: #6c757d;<br>  font-size: 1em;<br>  padding: 10px 0 10px 0;<br>}</pre><h3>Adding our feature components</h3><p>Now it’s time to add feature components to our MERN stack project.</p><h3>Create a new book</h3><p>Our CreateBook.js file is responsible for adding, creating, or saving a new book or a book&#39;s info. So, update CreateBook.js with the following code:</p><pre>import React, { Component } from &#39;react&#39;;<br>import { Link } from &#39;react-router-dom&#39;;<br>import &#39;../App.css&#39;;<br>import axios from &#39;axios&#39;;</pre><pre>class CreateBook extends Component {<br>  constructor() {<br>    super();<br>    this.state = {<br>      title: &#39;&#39;,<br>      isbn:&#39;&#39;,<br>      author:&#39;&#39;,<br>      description:&#39;&#39;,<br>      published_date:&#39;&#39;,<br>      publisher:&#39;&#39;<br>    };<br>  }</pre><pre>onChange = e =&gt; {<br>    this.setState({ [e.target.name]: e.target.value });<br>  };</pre><pre>onSubmit = e =&gt; {<br>    e.preventDefault();</pre><pre>const data = {<br>      title: this.state.title,<br>      isbn: this.state.isbn,<br>      author: this.state.author,<br>      description: this.state.description,<br>      published_date: this.state.published_date,<br>      publisher: this.state.publisher<br>    };</pre><pre>axios<br>      .post(&#39;http://localhost:8082/api/books&#39;, data)<br>      .then(res =&gt; {<br>        this.setState({<br>          title: &#39;&#39;,<br>          isbn:&#39;&#39;,<br>          author:&#39;&#39;,<br>          description:&#39;&#39;,<br>          published_date:&#39;&#39;,<br>          publisher:&#39;&#39;<br>        })<br>        this.props.history.push(&#39;/&#39;);<br>      })<br>      .catch(err =&gt; {<br>        console.log(&quot;Error in CreateBook!&quot;);<br>      })<br>  };</pre><pre>render() {<br>    return (<br>      &lt;div className=&quot;CreateBook&quot;&gt;<br>        &lt;div className=&quot;container&quot;&gt;<br>          &lt;div className=&quot;row&quot;&gt;<br>            &lt;div className=&quot;col-md-8 m-auto&quot;&gt;<br>              &lt;br /&gt;<br>              &lt;Link to=&quot;/&quot; className=&quot;btn btn-outline-warning float-left&quot;&gt;<br>                  Show BooK List<br>              &lt;/Link&gt;<br>            &lt;/div&gt;<br>            &lt;div className=&quot;col-md-8 m-auto&quot;&gt;<br>              &lt;h1 className=&quot;display-4 text-center&quot;&gt;Add Book&lt;/h1&gt;<br>              &lt;p className=&quot;lead text-center&quot;&gt;<br>                  Create new book<br>              &lt;/p&gt;</pre><pre>&lt;form noValidate onSubmit={this.onSubmit}&gt;<br>                &lt;div className=&#39;form-group&#39;&gt;<br>                  &lt;input<br>                    type=&#39;text&#39;<br>                    placeholder=&#39;Title of the Book&#39;<br>                    name=&#39;title&#39;<br>                    className=&#39;form-control&#39;<br>                    value={this.state.title}<br>                    onChange={this.onChange}<br>                  /&gt;<br>                &lt;/div&gt;<br>                &lt;br /&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>                  &lt;input<br>                    type=&#39;text&#39;<br>                    placeholder=&#39;ISBN&#39;<br>                    name=&#39;isbn&#39;<br>                    className=&#39;form-control&#39;<br>                    value={this.state.isbn}<br>                    onChange={this.onChange}<br>                  /&gt;<br>                &lt;/div&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>                  &lt;input<br>                    type=&#39;text&#39;<br>                    placeholder=&#39;Author&#39;<br>                    name=&#39;author&#39;<br>                    className=&#39;form-control&#39;<br>                    value={this.state.author}<br>                    onChange={this.onChange}<br>                  /&gt;<br>                &lt;/div&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>                  &lt;input<br>                    type=&#39;text&#39;<br>                    placeholder=&#39;Describe this book&#39;<br>                    name=&#39;description&#39;<br>                    className=&#39;form-control&#39;<br>                    value={this.state.description}<br>                    onChange={this.onChange}<br>                  /&gt;<br>                &lt;/div&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>                  &lt;input<br>                    type=&#39;date&#39;<br>                    placeholder=&#39;published_date&#39;<br>                    name=&#39;published_date&#39;<br>                    className=&#39;form-control&#39;<br>                    value={this.state.published_date}<br>                    onChange={this.onChange}<br>                  /&gt;<br>                &lt;/div&gt;<br>                &lt;div className=&#39;form-group&#39;&gt;<br>                  &lt;input<br>                    type=&#39;text&#39;<br>                    placeholder=&#39;Publisher of this Book&#39;<br>                    name=&#39;publisher&#39;<br>                    className=&#39;form-control&#39;<br>                    value={this.state.publisher}<br>                    onChange={this.onChange}<br>                  /&gt;<br>                &lt;/div&gt;</pre><pre>&lt;input<br>                    type=&quot;submit&quot;<br>                    className=&quot;btn btn-outline-warning btn-block mt-4&quot;<br>                /&gt;<br>              &lt;/form&gt;<br>          &lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default CreateBook;</pre><h3>Show all books</h3><p>The ShowBookList.js component will be responsible for showing all the books we already have stored in our database. Update ShowBookList.js with this code:</p><pre>import React, { Component } from &#39;react&#39;;<br>import &#39;../App.css&#39;;<br>import axios from &#39;axios&#39;;<br>import { Link } from &#39;react-router-dom&#39;;<br>import BookCard from &#39;./BookCard&#39;;</pre><pre>class ShowBookList extends Component {<br>  constructor(props) {<br>    super(props);<br>    this.state = {<br>      books: []<br>    };<br>  }</pre><pre>componentDidMount() {<br>    axios<br>      .get(&#39;http://localhost:8082/api/books&#39;)<br>      .then(res =&gt; {<br>        this.setState({<br>          books: res.data<br>        })<br>      })<br>      .catch(err =&gt;{<br>        console.log(&#39;Error from ShowBookList&#39;);<br>      })<br>  };</pre><pre>render() {<br>    const books = this.state.books;<br>    console.log(&quot;PrintBook: &quot; + books);<br>    let bookList;</pre><pre>if(!books) {<br>      bookList = &quot;there is no book record!&quot;;<br>    } else {<br>      bookList = books.map((book, k) =&gt;<br>        &lt;BookCard book={book} key={k} /&gt;<br>      );<br>    }</pre><pre>return (<br>      &lt;div className=&quot;ShowBookList&quot;&gt;<br>        &lt;div className=&quot;container&quot;&gt;<br>          &lt;div className=&quot;row&quot;&gt;<br>            &lt;div className=&quot;col-md-12&quot;&gt;<br>              &lt;br /&gt;<br>              &lt;h2 className=&quot;display-4 text-center&quot;&gt;Books List&lt;/h2&gt;<br>            &lt;/div&gt;</pre><pre>&lt;div className=&quot;col-md-11&quot;&gt;<br>              &lt;Link to=&quot;/create-book&quot; className=&quot;btn btn-outline-warning float-right&quot;&gt;<br>                + Add New Book<br>              &lt;/Link&gt;<br>              &lt;br /&gt;<br>              &lt;br /&gt;<br>              &lt;hr /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;div className=&quot;list&quot;&gt;<br>                {bookList}<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default ShowBookList;</pre><h3>Creating a card for each book</h3><p>Here we use a functional component called BookCard.js, which takes a book&#39;s info from ShowBookList.js and makes a card for each book. Write the following code to update your BookCard.js file:</p><pre>import React from &#39;react&#39;;<br>import { Link } from &#39;react-router-dom&#39;;<br>import &#39;../App.css&#39;;</pre><pre>const BookCard = (props) =&gt; {<br>    const  book  = props.book;</pre><pre>return(<br>        &lt;div className=&quot;card-container&quot;&gt;<br>            &lt;img src=&quot;https://commapress.co.uk/books/the-book-of-cairo/cairo-provisional-v3/image%2Fspan3&quot; alt=&quot;&quot; /&gt;<br>            &lt;div className=&quot;desc&quot;&gt;<br>                &lt;h2&gt;<br>                    &lt;Link to={`/show-book/${book._id}`}&gt;<br>                        { book.title }<br>                    &lt;/Link&gt;<br>                &lt;/h2&gt;<br>                &lt;h3&gt;{book.author}&lt;/h3&gt;<br>                &lt;p&gt;{book.description}&lt;/p&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    )<br>};</pre><pre>export default BookCard;</pre><p><strong>NOTE:</strong> Here, I used the same img src for each book, since each book&#39;s respective image may not always be available. Change the image source, and you can also use a different image for each book.</p><h3>Show a book’s info</h3><p>The ShowBookDetails component has one task: it shows all the info we have about any book. We have both delete and edit buttons here to get access.</p><pre>import React, { Component } from &#39;react&#39;;<br>import { Link } from &#39;react-router-dom&#39;;<br>import &#39;../App.css&#39;;<br>import axios from &#39;axios&#39;;</pre><pre>class showBookDetails extends Component {<br>  constructor(props) {<br>    super(props);<br>    this.state = {<br>      book: {}<br>    };<br>  }</pre><pre>componentDidMount() {<br>    // console.log(&quot;Print id: &quot; + this.props.match.params.id);<br>    axios<br>      .get(&#39;http://localhost:8082/api/books/&#39;+this.props.match.params.id)<br>      .then(res =&gt; {<br>        // console.log(&quot;Print-showBookDetails-API-response: &quot; + res.data);<br>        this.setState({<br>          book: res.data<br>        })<br>      })<br>      .catch(err =&gt; {<br>        console.log(&quot;Error from ShowBookDetails&quot;);<br>      })<br>  };</pre><pre>onDeleteClick (id) {<br>    axios<br>      .delete(&#39;http://localhost:8082/api/books/&#39;+id)<br>      .then(res =&gt; {<br>        this.props.history.push(&quot;/&quot;);<br>      })<br>      .catch(err =&gt; {<br>        console.log(&quot;Error form ShowBookDetails_deleteClick&quot;);<br>      })<br>  };</pre><pre>render() {</pre><pre>const book = this.state.book;<br>    let BookItem = &lt;div&gt;<br>      &lt;table className=&quot;table table-hover table-dark&quot;&gt;<br>        {/* &lt;thead&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;col&quot;&gt;#&lt;/th&gt;<br>            &lt;th scope=&quot;col&quot;&gt;First&lt;/th&gt;<br>            &lt;th scope=&quot;col&quot;&gt;Last&lt;/th&gt;<br>            &lt;th scope=&quot;col&quot;&gt;Handle&lt;/th&gt;<br>          &lt;/tr&gt;<br>        &lt;/thead&gt; */}<br>        &lt;tbody&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;row&quot;&gt;1&lt;/th&gt;<br>            &lt;td&gt;Title&lt;/td&gt;<br>            &lt;td&gt;{ book.title }&lt;/td&gt;<br>          &lt;/tr&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;row&quot;&gt;2&lt;/th&gt;<br>            &lt;td&gt;Author&lt;/td&gt;<br>            &lt;td&gt;{ book.author }&lt;/td&gt;<br>          &lt;/tr&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;row&quot;&gt;3&lt;/th&gt;<br>            &lt;td&gt;ISBN&lt;/td&gt;<br>            &lt;td&gt;{ book.isbn }&lt;/td&gt;<br>          &lt;/tr&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;row&quot;&gt;4&lt;/th&gt;<br>            &lt;td&gt;Publisher&lt;/td&gt;<br>            &lt;td&gt;{ book.publisher }&lt;/td&gt;<br>          &lt;/tr&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;row&quot;&gt;5&lt;/th&gt;<br>            &lt;td&gt;Published Date&lt;/td&gt;<br>            &lt;td&gt;{ book.published_date }&lt;/td&gt;<br>          &lt;/tr&gt;<br>          &lt;tr&gt;<br>            &lt;th scope=&quot;row&quot;&gt;6&lt;/th&gt;<br>            &lt;td&gt;Description&lt;/td&gt;<br>            &lt;td&gt;{ book.description }&lt;/td&gt;<br>          &lt;/tr&gt;<br>        &lt;/tbody&gt;<br>      &lt;/table&gt;<br>    &lt;/div&gt;</pre><pre>return (<br>      &lt;div className=&quot;ShowBookDetails&quot;&gt;<br>        &lt;div className=&quot;container&quot;&gt;<br>          &lt;div className=&quot;row&quot;&gt;<br>            &lt;div className=&quot;col-md-10 m-auto&quot;&gt;<br>              &lt;br /&gt; &lt;br /&gt;<br>              &lt;Link to=&quot;/&quot; className=&quot;btn btn-outline-warning float-left&quot;&gt;<br>                  Show Book List<br>              &lt;/Link&gt;<br>            &lt;/div&gt;<br>            &lt;br /&gt;<br>            &lt;div className=&quot;col-md-8 m-auto&quot;&gt;<br>              &lt;h1 className=&quot;display-4 text-center&quot;&gt;Book&#39;s Record&lt;/h1&gt;<br>              &lt;p className=&quot;lead text-center&quot;&gt;<br>                  View Book&#39;s Info<br>              &lt;/p&gt;<br>              &lt;hr /&gt; &lt;br /&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>          &lt;div&gt;<br>            { BookItem }<br>          &lt;/div&gt;</pre><pre>&lt;div className=&quot;row&quot;&gt;<br>            &lt;div className=&quot;col-md-6&quot;&gt;<br>              &lt;button type=&quot;button&quot; className=&quot;btn btn-outline-danger btn-lg btn-block&quot; onClick={this.onDeleteClick.bind(this,book._id)}&gt;Delete Book&lt;/button&gt;&lt;br /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;div className=&quot;col-md-6&quot;&gt;<br>              &lt;Link to={`/edit-book/${book._id}`} className=&quot;btn btn-outline-info btn-lg btn-block&quot;&gt;<br>                    Edit Book<br>              &lt;/Link&gt;<br>              &lt;br /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;/div&gt;<br>            {/* &lt;br /&gt;<br>            &lt;button type=&quot;button&quot; class=&quot;btn btn-outline-info btn-lg btn-block&quot;&gt;Edit Book&lt;/button&gt;<br>            &lt;button type=&quot;button&quot; class=&quot;btn btn-outline-danger btn-lg btn-block&quot;&gt;Delete Book&lt;/button&gt; */}</pre><pre>&lt;/div&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default showBookDetails;</pre><h3>Update a book’s info</h3><p>UpdateBookInfo.js, as its name indicates, is responsible for updating a book&#39;s info. An <strong>Edit Book</strong> button will trigger this component to perform. After clicking <strong>Edit Book</strong>, we will see a form with the old info, which we will be able to edit or replace.</p><pre>import React, { Component } from &#39;react&#39;;<br>import { Link } from &#39;react-router-dom&#39;;<br>import axios from &#39;axios&#39;;<br>import &#39;../App.css&#39;;</pre><pre>class UpdateBookInfo extends Component {<br>  constructor(props) {<br>    super(props);<br>    this.state = {<br>      title: &#39;&#39;,<br>      isbn: &#39;&#39;,<br>      author: &#39;&#39;,<br>      description: &#39;&#39;,<br>      published_date: &#39;&#39;,<br>      publisher: &#39;&#39;<br>    };<br>  }</pre><pre>componentDidMount() {<br>    // console.log(&quot;Print id: &quot; + this.props.match.params.id);<br>    axios<br>      .get(&#39;http://localhost:8082/api/books/&#39;+this.props.match.params.id)<br>      .then(res =&gt; {<br>        // this.setState({...this.state, book: res.data})<br>        this.setState({<br>          title: res.data.title,<br>          isbn: res.data.isbn,<br>          author: res.data.author,<br>          description: res.data.description,<br>          published_date: res.data.published_date,<br>          publisher: res.data.publisher<br>        })<br>      })<br>      .catch(err =&gt; {<br>        console.log(&quot;Error from UpdateBookInfo&quot;);<br>      })<br>  };</pre><pre>onChange = e =&gt; {<br>    this.setState({ [e.target.name]: e.target.value });<br>  };</pre><pre>onSubmit = e =&gt; {<br>    e.preventDefault();</pre><pre>const data = {<br>      title: this.state.title,<br>      isbn: this.state.isbn,<br>      author: this.state.author,<br>      description: this.state.description,<br>      published_date: this.state.published_date,<br>      publisher: this.state.publisher<br>    };</pre><pre>axios<br>      .put(&#39;http://localhost:8082/api/books/&#39;+this.props.match.params.id, data)<br>      .then(res =&gt; {<br>        this.props.history.push(&#39;/show-book/&#39;+this.props.match.params.id);<br>      })<br>      .catch(err =&gt; {<br>        console.log(&quot;Error in UpdateBookInfo!&quot;);<br>      })<br>  };</pre><pre>render() {<br>    return (<br>      &lt;div className=&quot;UpdateBookInfo&quot;&gt;<br>        &lt;div className=&quot;container&quot;&gt;<br>          &lt;div className=&quot;row&quot;&gt;<br>            &lt;div className=&quot;col-md-8 m-auto&quot;&gt;<br>              &lt;br /&gt;<br>              &lt;Link to=&quot;/&quot; className=&quot;btn btn-outline-warning float-left&quot;&gt;<br>                  Show BooK List<br>              &lt;/Link&gt;<br>            &lt;/div&gt;<br>            &lt;div className=&quot;col-md-8 m-auto&quot;&gt;<br>              &lt;h1 className=&quot;display-4 text-center&quot;&gt;Edit Book&lt;/h1&gt;<br>              &lt;p className=&quot;lead text-center&quot;&gt;<br>                  Update Book&#39;s Info<br>              &lt;/p&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;</pre><pre>&lt;div className=&quot;col-md-8 m-auto&quot;&gt;<br>          &lt;form noValidate onSubmit={this.onSubmit}&gt;<br>            &lt;div className=&#39;form-group&#39;&gt;<br>              &lt;label htmlFor=&quot;title&quot;&gt;Title&lt;/label&gt;<br>              &lt;input<br>                type=&#39;text&#39;<br>                placeholder=&#39;Title of the Book&#39;<br>                name=&#39;title&#39;<br>                className=&#39;form-control&#39;<br>                value={this.state.title}<br>                onChange={this.onChange}<br>              /&gt;<br>            &lt;/div&gt;<br>            &lt;br /&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>            &lt;label htmlFor=&quot;isbn&quot;&gt;ISBN&lt;/label&gt;<br>              &lt;input<br>                type=&#39;text&#39;<br>                placeholder=&#39;ISBN&#39;<br>                name=&#39;isbn&#39;<br>                className=&#39;form-control&#39;<br>                value={this.state.isbn}<br>                onChange={this.onChange}<br>              /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>            &lt;label htmlFor=&quot;author&quot;&gt;Author&lt;/label&gt;<br>              &lt;input<br>                type=&#39;text&#39;<br>                placeholder=&#39;Author&#39;<br>                name=&#39;author&#39;<br>                className=&#39;form-control&#39;<br>                value={this.state.author}<br>                onChange={this.onChange}<br>              /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>            &lt;label htmlFor=&quot;description&quot;&gt;Description&lt;/label&gt;<br>              &lt;input<br>                type=&#39;text&#39;<br>                placeholder=&#39;Describe this book&#39;<br>                name=&#39;description&#39;<br>                className=&#39;form-control&#39;<br>                value={this.state.description}<br>                onChange={this.onChange}<br>              /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;div className=&#39;form-group&#39;&gt;<br>            &lt;label htmlFor=&quot;published_date&quot;&gt;Published Date&lt;/label&gt;<br>              &lt;input<br>                type=&#39;date&#39;<br>                placeholder=&#39;published_date&#39;<br>                name=&#39;published_date&#39;<br>                className=&#39;form-control&#39;<br>                value={this.state.published_date}<br>                onChange={this.onChange}<br>              /&gt;<br>            &lt;/div&gt;<br>            &lt;div className=&#39;form-group&#39;&gt;<br>            &lt;label htmlFor=&quot;publisher&quot;&gt;Publisher&lt;/label&gt;<br>              &lt;input<br>                type=&#39;text&#39;<br>                placeholder=&#39;Publisher of this Book&#39;<br>                name=&#39;publisher&#39;<br>                className=&#39;form-control&#39;<br>                value={this.state.publisher}<br>                onChange={this.onChange}<br>              /&gt;<br>            &lt;/div&gt;</pre><pre>&lt;button type=&quot;submit&quot; className=&quot;btn btn-outline-info btn-lg btn-block&quot;&gt;Update Book&lt;/button&gt;<br>            &lt;/form&gt;<br>          &lt;/div&gt;</pre><pre>&lt;/div&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default UpdateBookInfo;</pre><h3>Connecting the frontend to the backend</h3><p>We just implemented all of our components! Now we need a little change in our server-side (back-end) project.</p><h3>Changes required on the backend</h3><p>If we try to call our back-end API from the front-end part, it gets an error that says: “Access to XMLHttpRequest at ‘ <a href="http://localhost:8082/api/books&amp;#8217">http://localhost:8082/api/books&amp;#8217</a>; from origin ‘ <a href="http://localhost:3000&amp;#8217">http://localhost:3000&amp;#8217</a>; has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”</p><p>To solve this, we need to install cors in our back-end (server-side) project. Go to the project folder (e.g., MERN_A_to_Z) and run:</p><pre>$ npm install cors</pre><p>Now, update app.js (the back end&#39;s entry point) with the following code:</p><pre>// app.js</pre><pre>const express = require(&#39;express&#39;);<br>const connectDB = require(&#39;./config/db&#39;);<br>var cors = require(&#39;cors&#39;);</pre><pre>// routes<br>const books = require(&#39;./routes/api/books&#39;);</pre><pre>const app = express();</pre><pre>// Connect Database<br>connectDB();</pre><pre>// cors<br>app.use(cors({ origin: true, credentials: true }));</pre><pre>// Init Middleware<br>app.use(express.json({ extended: false }));</pre><pre>app.get(&#39;/&#39;, (req, res) =&gt; res.send(&#39;Hello world!&#39;));</pre><pre>// use Routes<br>app.use(&#39;/api/books&#39;, books);</pre><pre>const port = process.env.PORT || 8082;</pre><pre>app.listen(port, () =&gt; console.log(`Server running on port ${port}`));</pre><h3>Running the frontend and backend</h3><p>Follow the steps below to run both the front end and backend of our MERN stack example.</p><h3>Run the server</h3><p>Now, run the server (inside the project folder):</p><pre>$ npm run app</pre><p>If you get any errors, then follow the commands below (inside the project folder):</p><pre>$ npm install <br>$ npm run app</pre><h3>Run the client</h3><p>From the front-end project directory, run the command below:</p><pre>$ npm start</pre><p>If you get an error, again, follow the same commands below:</p><pre>$ npm install <br>$ npm start</pre><h3>Testing our MERN stack app in the browser</h3><p>Let’s check everything in the browser. Open <a href="http://localhost:3000/">http://localhost:3000</a> in your browser. Now you can add a book, delete a book, show the list of books, and edit books. The following routes should perform accordingly:</p><p><strong>Add a new book:</strong> <a href="http://localhost:3000/create-book">http://localhost:3000/create-book</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*zXkxY9rHSMT9-q9A.png" /></figure><p><strong>Show the list of books: </strong><a href="http://localhost:3000/">http://localhost:3000/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*w-zJKydrPL9LFGbG.png" /></figure><p><strong>Show any book’s info: </strong><a href="http://localhost:3000/show-book/:id">http://localhost:3000/show-book/:id</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*LKwm9H7bkYv3c0F2.png" /></figure><p><strong>Update a book’s info: </strong><a href="http://localhost:3000/edit-book/:id">http://localhost:3000/edit-book/:id</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*CbWJNduYOXGbpdbs.png" /></figure><p>Congratulations! You have successfully completed this MERN stack tutorial.</p><p>Read part 1 <a href="https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-1-290203ea19c7">here</a> and part 2 <a href="https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-2-7ff2320da7f">here</a>.</p><p>You can <a href="https://github.com/nurislam03/">visit my GitHub</a> to see both the <a href="https://github.com/nurislam03/MERN_A_to_Z">server-side</a> and <a href="https://github.com/nurislam03/MERN_A_to_Z_Client">client-side</a> portions of this MERN stack tutorial. You can also find the complete repo for our MERN stack example app on <a href="https://github.com/nurislam03/MERN_A_to_Z">GitHub</a>.</p><p><em>Originally published at </em><a href="https://blog.logrocket.com/mern-stack-tutorial/"><em>https://blog.logrocket.com</em></a><em> on February 26, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5b65c490e42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MERN Stack: A complete MERN guide - Part 2]]></title>
            <link>https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-2-7ff2320da7f?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ff2320da7f</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mern-stack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Thu, 29 Sep 2022 22:41:36 GMT</pubDate>
            <atom:updated>2022-09-29T22:44:56.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*cNpuzy8MvVOMlfCJrxtc8g.png" /></figure><p>This tutorial is all about the MERN stack. We’ll outline the basics of the MERN stack and demonstrate how to use it by developing a simple CRUD application from scratch.</p><p>To show how the MERN stack works, we’ll first configure the server side by connecting Node.js and Express.js to MongoDB on the backend. Then, we’ll create some APIs. After that, we’ll walk you through building the front end, using React to build our user interfaces. Once both are complete, we’ll connect the front end to the back end.</p><p>Meanwhile, we’ll cover the following topics</p><ul><li>Database management with MongoDB</li><li>Building RESTful APIs with the MERN stack</li><li>Building the frontend</li><li>Setting up Create React App</li><li>Initial project structure</li><li>Frontend tasks and features</li><li>Adding feature components</li><li>Connecting the frontend and backend</li><li>Running the frontend and backend</li><li>Testing our MERN stack app in the browser</li></ul><p>This demo is designed to highlight the MERN setup. The objective is to develop a simple project with the best possible structure so that you can use it as a boilerplate and elevate your MERN stack projects to meet industry standards.</p><h3>Database management with MongoDB</h3><p>Now it’s time to work on our <a href="https://www.mongodb.com/mern-stack">MERN database setup with MongoDB</a>. For simplicity, we will use MongoDB Atlas.</p><h3>Creating an account for MongoDB Atlas</h3><p>MongoDB Atlas is a fully managed cloud database developed by the same team that built MongoDB.</p><p>First, <a href="https://www.mongodb.com/cloud/atlas">you need an account</a>. Create one and follow the procedure. After creating an account, you will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*2gg7m0VaT6OqaSj3.png" /></figure><p>Click on the <strong>Project 0</strong> section (top left) and you will see a button for creating a new project. Create a project and select the project.</p><p>Now, click on the <strong>Build a Cluster</strong> button from the project you have created. It will show you all the information. At the bottom, you will see a section called <strong>Cluster Name</strong>, click on that and enter a name for the database, then hit the <strong>Create Cluster</strong> button.</p><p>After two to three minutes, if everything goes well, you will find something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HvtuHghi50926tTD.png" /></figure><p>Click on the <strong>CONNECT</strong> button and fill in the username and password form for your database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*r4LEf80nbrTrjvQN.png" /></figure><p>Now hit the <strong>Create MongoDB User</strong> button. You can also choose either your current IP address or a different IP address, it’s up to you.</p><p>Now, if you follow the <strong>CONNECT</strong> button or the <strong>Choose a connection method</strong> button, you will see some different methods. Select accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*a6W4Vlqcxl8Z0VOl.png" /></figure><p>In this case, select the <strong>Connect Your Application</strong> section.</p><p>Now you will get your database link, which we will use in our next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*KIw97h4Qi-1U3DhE.png" /></figure><p>Our database is ready — now we need to add it to our project.</p><p>Inside the project folder, create another folder named config and inside it create two files named default.json and db.js. Add the following code:</p><pre>// default.json</pre><pre>{<br>  &quot;mongoURI&quot;:<br>    &quot;mongodb+srv://mern123:&lt;password&gt;@mernatoz-9kdpd.mongodb.net/test?retryWrites=true&amp;w=majority&quot;<br>}<br> <strong>/* Replace &lt;password&gt; with your database password */</strong></pre><p>Note: Replace &lt;password&gt; with your database password</p><pre>// db.js</pre><pre>const mongoose = require(&#39;mongoose&#39;);<br>const config = require(&#39;config&#39;);<br>const db = config.get(&#39;mongoURI&#39;);</pre><pre>const connectDB = async () =&gt; {<br>  try {<br>    await mongoose.connect(<br>      db,<br>      {<br>        useNewUrlParser: true<br>      }<br>    );</pre><pre>    console.log(&#39;MongoDB is Connected...&#39;);<br>  } catch (err) {<br>    console.error(err.message);<br>    process.exit(1);<br>  }<br>};</pre><pre>module.exports = connectDB;</pre><p><strong>NOTE:</strong> We need a little change in our app.js file to connect to the database. Update your app.js with this:</p><pre>// app.js</pre><pre>const express = require(&#39;express&#39;);<br>const connectDB = require(&#39;./config/db&#39;);</pre><pre>const app = express();</pre><pre>// Connect Database<br>connectDB();</pre><pre>app.get(&#39;/&#39;, (req, res) =&gt; res.send(&#39;Hello world!&#39;));</pre><pre>const port = process.env.PORT || 8082;</pre><pre>app.listen(port, () =&gt; console.log(`Server running on port ${port}`));</pre><p>We need another dependency package called config for the global variable to run our project. Use the following command to install it to the project:</p><pre>$ npm i config</pre><p>Now, you can run the project using the following command:</p><pre>$ npm run app</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*1xkfLovkSaWRmRMJ.png" /></figure><p>Great! So far we are on the right track. Our database is successfully connected. Now time to complete the route setup, and after that, we will see how to create RESTful APIs.</p><h3>Building RESTful APIs with the MERN stack</h3><p>Create a folder named routes. In it, create another folder named api, which will hold all our APIs.</p><p>Inside the api folder, create a file named books.js. We will create some APIs here to show how it works in a moment.</p><p>Now update your books.js with the following code:</p><pre>// routes/api/books.js</pre><pre>const express = require(&#39;express&#39;);<br>const router = express.Router();</pre><pre>// Load Book model<br>const Book = require(&#39;../../models/Book&#39;);</pre><pre>// @route GET api/books/test<br>// @description tests books route<br>// @access Public<br>router.get(&#39;/test&#39;, (req, res) =&gt; res.send(&#39;book route testing!&#39;));</pre><pre>// @route GET api/books<br>// @description Get all books<br>// @access Public<br>router.get(&#39;/&#39;, (req, res) =&gt; {<br>  Book.find()<br>    .then(books =&gt; res.json(books))<br>    .catch(err =&gt; res.status(404).json({ nobooksfound: &#39;No Books found&#39; }));<br>});</pre><pre>// @route GET api/books/:id<br>// @description Get single book by id<br>// @access Public<br>router.get(&#39;/:id&#39;, (req, res) =&gt; {<br>  Book.findById(req.params.id)<br>    .then(book =&gt; res.json(book))<br>    .catch(err =&gt; res.status(404).json({ nobookfound: &#39;No Book found&#39; }));<br>});</pre><pre>// @route GET api/books<br>// @description add/save book<br>// @access Public<br>router.post(&#39;/&#39;, (req, res) =&gt; {<br>  Book.create(req.body)<br>    .then(book =&gt; res.json({ msg: &#39;Book added successfully&#39; }))<br>    .catch(err =&gt; res.status(400).json({ error: &#39;Unable to add this book&#39; }));<br>});</pre><pre>// @route GET api/books/:id<br>// @description Update book<br>// @access Public<br>router.put(&#39;/:id&#39;, (req, res) =&gt; {<br>  Book.findByIdAndUpdate(req.params.id, req.body)<br>    .then(book =&gt; res.json({ msg: &#39;Updated successfully&#39; }))<br>    .catch(err =&gt;<br>      res.status(400).json({ error: &#39;Unable to update the Database&#39; })<br>    );<br>});</pre><pre>// @route GET api/books/:id<br>// @description Delete book by id<br>// @access Public<br>router.delete(&#39;/:id&#39;, (req, res) =&gt; {<br>  Book.findByIdAndRemove(req.params.id, req.body)<br>    .then(book =&gt; res.json({ mgs: &#39;Book entry deleted successfully&#39; }))<br>    .catch(err =&gt; res.status(404).json({ error: &#39;No such a book&#39; }));<br>});</pre><pre>module.exports = router;</pre><h3>Database model</h3><p>In order to interact with our database, we need to create a model for each of our resources. So, create a folder called models in the root, and inside the models folder, create a file called Book.js and update it with this:</p><pre>// models/Book.js</pre><pre>const mongoose = require(&#39;mongoose&#39;);</pre><pre>const BookSchema = new mongoose.Schema({<br>  title: {<br>    type: String,<br>    required: true<br>  },<br>  isbn: {<br>    type: String,<br>    required: true<br>  },<br>  author: {<br>    type: String,<br>    required: true<br>  },<br>  description: {<br>    type: String<br>  },<br>  published_date: {<br>    type: Date<br>  },<br>  publisher: {<br>    type: String<br>  },<br>  updated_date: {<br>    type: Date,<br>    default: Date.now<br>  }<br>});</pre><pre>module.exports = Book = mongoose.model(&#39;book&#39;, BookSchema);</pre><p>Run the project to see if everything is fine at this point, and you can test all the APIs through Postman (note that before testing APIs using Postman, you need to run the project first). You can <a href="https://www.getpostman.com/">download Postman here</a>.</p><p>Congratulations! You have successfully completed this MERN stack tutorial part 2, read part 1 <a href="https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-1-290203ea19c7">here</a> and part 3 <a href="https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-3-e5b65c490e42">here</a>.</p><p>You can <a href="https://github.com/nurislam03/">visit my GitHub</a> to see both the <a href="https://github.com/nurislam03/MERN_A_to_Z">server-side</a> and <a href="https://github.com/nurislam03/MERN_A_to_Z_Client">client-side</a> portions of this MERN stack tutorial. You can also find the complete repo for our MERN stack example app on <a href="https://github.com/nurislam03/MERN_A_to_Z">GitHub</a>.</p><p><em>Originally published at </em><a href="https://blog.logrocket.com/mern-stack-tutorial/"><em>https://blog.logrocket.com</em></a><em> on February 26, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ff2320da7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MERN Stack: A complete MERN guide - Part 1]]></title>
            <link>https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-1-290203ea19c7?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/290203ea19c7</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[mern-stack]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Fri, 26 Feb 2021 17:01:05 GMT</pubDate>
            <atom:updated>2022-09-29T22:46:40.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*cNpuzy8MvVOMlfCJrxtc8g.png" /></figure><p>This tutorial is all about the MERN stack. We’ll outline the basics of the MERN stack and demonstrate how to use it by developing a simple CRUD application from scratch.</p><p>To show how the MERN stack works, we’ll first configure the server side by connecting Node.js and Express.js to MongoDB on the backend. Then, we’ll create some APIs. After that, we’ll walk you through building the front end, using React to build our user interfaces. Once both are complete, we’ll connect the front end to the back end.</p><p>Meanwhile, we’ll cover the following MERN stack topics:</p><ul><li>What is the MERN stack?</li><li>Server setup with Express.js and Node.js</li><li>Database management with MongoDB</li><li>Building RESTful APIs with the MERN stack</li><li>Building the frontend</li><li>Setting up Create React App</li><li>Initial project structure</li><li>Frontend tasks and features</li><li>Adding feature components</li><li>Connecting the frontend and backend</li><li>Running the frontend and backend</li><li>Testing our MERN stack app in the browser</li></ul><p>This demo is designed to highlight the MERN setup. The objective is to develop a simple project with the best possible structure so that you can use it as a boilerplate and elevate your MERN stack projects to meet industry standards.</p><h3>What is the MERN stack?</h3><p>The phrase MERN stack refers to the following technologies:</p><ul><li><a href="https://www.mongodb.com/"><strong>MongoDB</strong></a>, a cross-platform document-oriented database program</li><li><a href="https://expressjs.com/"><strong>Express.js</strong></a>, a web application framework for Node.js</li><li><a href="https://reactjs.org/"><strong>React</strong></a>, a JavaScript library for building user interfaces</li><li><a href="https://nodejs.org/en/"><strong>Node.js</strong></a>, is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser</li></ul><h3>Server setup with Express.js and Node.js</h3><p>To begin our MERN stack tutorial, we’ll show you how to set up a server with Express.js and Node.js.</p><h3>npm package initialization</h3><p>To create a project folder, enter the folder through the terminal, then run the following command:</p><pre>$ npm init</pre><p>Now it will ask you some questions about package name, version, entry point, etc. Hit enter if you want to keep the default. After that, you will get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*gJ4gZvpxp8cNlN7H.png" /></figure><p>Select <strong>yes</strong> and you’re ready to go. It creates a file named package.json.</p><h3>Installing dependencies</h3><p>Now, I would like to add some dependencies:</p><pre>$ npm i express mongoose body-parser bcryptjs validation</pre><p>Type or copy the command above and hit the enter button. You’ll see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*IgxaRY4jn0r8jfwj.png" /></figure><ul><li>bcryptjs is a password hashing function designed by Niels Provos and David Mazières (will be using them later)</li><li>body-parser allows us to get the data throughout the request</li><li>express is our main framework</li><li>mongoose is used to connect/interact with MongoDB</li><li>validation (as its name implies) is used for validation</li></ul><p>Now I want to add <a href="https://nodemon.io/">nodemon</a> as a dev dependency. If you don’t want to add this, you can skip it — it’s optional.</p><pre>$ npm i -D nodemon</pre><p>nodemon is a utility that will monitor for any changes in your source and automatically restart your server.</p><p>At that point, your package.json should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/0*XH-sFK0SnbE_n9Rw.png" /></figure><h3>Setting the entry point</h3><p>Now create a file named app.js for our entry point. You can create this from the project folder with the command below (on Mac):</p><pre>$ touch app.js</pre><p>Then paste the code below:</p><pre>// app.js<br><br>const express = require(&#39;express&#39;);<br><br>const app = express();<br><br>app.get(&#39;/&#39;, (req, res) =&gt; res.send(&#39;Hello world!&#39;));<br><br>const port = process.env.PORT || 8082;<br><br>app.listen(port, () =&gt; console.log(`Server running on port ${port}`));</pre><p>Now, run the command</p><pre>$ node app</pre><p>You will see Server running on port 8082. You can also check it from the browser: open the browser and enter <a href="http://localhost:8082/">http://localhost:8082</a>.</p><p>At this point, if we change anything, we need to restart the server manually. But if we set up nodemon, then we don’t have to restart it every time; nodemon will watch if there is any change and restart the server automatically.</p><p>So what you need to do for that is a little change to the scripts in our package.json file. See below:</p><pre>// package.json<br><br>{<br>  &quot;name&quot;: &quot;mern_a_to_z&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;main&quot;: &quot;app.js&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;node app.js&quot;,<br>    &quot;app&quot;: &quot;nodemon app.js&quot;,<br>    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;<br>  },<br>  &quot;repository&quot;: {<br>    &quot;type&quot;: &quot;git&quot;,<br>    &quot;url&quot;: &quot;git+https://github.com/nurislam03/MERN_A_to_Z.git&quot;<br>  },<br>  &quot;author&quot;: &quot;Nur Islam&quot;,<br>  &quot;license&quot;: &quot;MIT&quot;,<br>  &quot;bugs&quot;: {<br>    &quot;url&quot;: &quot;https://github.com/nurislam03/MERN_A_to_Z/issues&quot;<br>  },<br>  &quot;homepage&quot;: &quot;https://github.com/nurislam03/MERN_A_to_Z#readme&quot;,<br>  &quot;dependencies&quot;: {<br>    &quot;bcryptjs&quot;: &quot;^2.4.3&quot;,<br>    &quot;body-parser&quot;: &quot;^1.19.0&quot;,<br>    &quot;express&quot;: &quot;^4.17.1&quot;,<br>    &quot;mongoose&quot;: &quot;^5.5.15&quot;,<br>    &quot;validation&quot;: &quot;0.0.1&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;nodemon&quot;: &quot;^1.19.1&quot;<br>  }<br>}</pre><p>So, now you can run your project using this command:</p><pre>$ npm run app</pre><p>If you get any error at this point, then run the commands below:</p><pre>$ npm install <br>$ npm run app</pre><p>You will see the following changes in your terminal if everything goes right:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*a2RQymERvchJk8Oz.png" /></figure><p>Read the next tutorial - part 2 <a href="https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-2-7ff2320da7f">here</a>. If you want to skip part 2 and start exploring the frontend part then read part 3 <a href="https://medium.com/@nur_islam/mern-stack-a-complete-mern-guide-part-3-e5b65c490e42">here</a>.</p><p>You can <a href="https://github.com/nurislam03/">visit my GitHub</a> to see both the <a href="https://github.com/nurislam03/MERN_A_to_Z">server-side</a> and <a href="https://github.com/nurislam03/MERN_A_to_Z_Client">client-side</a> portions of this MERN stack tutorial. You can also find the complete repo for our MERN stack example app on <a href="https://github.com/nurislam03/MERN_A_to_Z">GitHub</a>.</p><p><em>Originally published at </em><a href="https://blog.logrocket.com/mern-stack-tutorial/"><em>https://blog.logrocket.com</em></a><em> on February 26, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=290203ea19c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Commit: Making a commit to Git repository!]]></title>
            <link>https://medium.com/@nur_islam/git-commit-making-a-commit-to-git-repository-66d12a4a3e28?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/66d12a4a3e28</guid>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[commit]]></category>
            <category><![CDATA[git-commit]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Mon, 22 Apr 2019 15:11:46 GMT</pubDate>
            <atom:updated>2019-04-22T15:17:20.497Z</atom:updated>
            <content:encoded><![CDATA[<p>[<a href="https://medium.com/@nur_islam/all-contents-d62360f70e65?source=friends_link&amp;sk=150c64aac300b41b09314c7e1c067dd2">Click here to see my all posts</a>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3qnJhXkAxguw5oXz8eMaoA.png" /></figure><p>Here I’ll show you how you can make a commit to your git repository and also show you how to push the local commit to your Github repository.</p><ol><li>Open terminal</li></ol><p>3. Set the current working directory to the local project (where you working now)</p><p>3.<em> Optional</em>: To check the current updated file to the local directory. It will display the files name which has been edited. You will see a list of files name in <em>red color</em> if there are any updated file.</p><pre>$ git status</pre><p>4. Add all the files to your local repository.</p><pre>$ git add --all   //or<br>$ git add .</pre><p>5. <em>Optional:</em> You can add any specific file using the file name instead of --all</p><pre>$ git add file_name</pre><p>6. <em>Optional</em>: After adding the file, you can use $ git status. In this point, you will see those files name you added are marked in <em>green color</em>.</p><p>7. Commit the files that you have just added</p><pre>$ git commit -m &quot;commit message&quot;</pre><p>8. Now, Push the local changes to your Github repository.</p><pre>$ git push origin master</pre><p>9. Done! Check your Github repository you will find the changes there. :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66d12a4a3e28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All Contents]]></title>
            <link>https://medium.com/@nur_islam/all-contents-d62360f70e65?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/d62360f70e65</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Sat, 13 Apr 2019 09:37:21 GMT</pubDate>
            <atom:updated>2019-04-22T15:13:28.506Z</atom:updated>
            <content:encoded><![CDATA[<p>Web Development</p><ol><li><a href="https://medium.com/@nur_islam/complete-node-js-project-setup-from-docker-to-testing-docker-restfull-apis-with-node-js-9f384e06734a?source=friends_link&amp;sk=4111597be03e857e47045df31d59c48e">Complete Node js Project Setup from Docker to Testing-[Docker |RESTfull APIs with Node.js | Express.js | MongoDB | Integration Testing with JEST]</a></li><li><a href="https://medium.com/@nur_islam/road-to-docker-6960fbc48ef4?source=friends_link&amp;sk=8924b4ae27ebce417a71812716d4d771">Road to Docker - (Installation)</a></li></ol><p>Git and Github</p><ol><li><a href="https://medium.com/@nur_islam/github-repository-cloning-f921c0dd8d58?source=friends_link&amp;sk=fadad58bbe0fe8e467ead7b68706c40d">Github Repository Cloning</a></li><li><a href="https://medium.com/@nur_islam/git-commit-making-a-commit-to-git-repository-66d12a4a3e28?source=friends_link&amp;sk=13c34275b181900cdab4feb555ff6a1c">Git Commit: Making a commit to Git Repository</a></li><li><a href="https://medium.com/@nur_islam/merging-a-branch-into-master-in-github-47955c901487?source=friends_link&amp;sk=6aaa40310a33a46cef0f398de44f173d">Merging a branch into Master</a></li></ol><p>C&amp; C++ Programming Tutorials [A-Z]</p><ol><li><a href="https://medium.com/@nur_islam/environment-setup-compiler-installation-a2c8409812cc?source=friends_link&amp;sk=66013d4eead4228704bffb0a7b77c242">Environment Setup — Compiler installation</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d62360f70e65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complete Node js Project Setup from Docker to Testing-[Docker |RESTfull APIs with Node.js]]></title>
            <link>https://medium.com/@nur_islam/complete-node-js-project-setup-from-docker-to-testing-docker-restfull-apis-with-node-js-9f384e06734a?source=rss-f5b45464a760------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f384e06734a</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Nur Islam]]></dc:creator>
            <pubDate>Fri, 15 Mar 2019 16:19:05 GMT</pubDate>
            <atom:updated>2019-03-24T15:33:48.319Z</atom:updated>
            <content:encoded><![CDATA[<h3>Complete Node js Project Setup from Docker to Testing-[Docker |RESTfull APIs with Node.js | Express.js | MongoDB | Integration Testing with JEST]</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mf2KttzE3v4uKjA71f9CZw.jpeg" /></figure><p>In this tutorial, I’ll show you how to set up a simple project with Node.js + Express.js + MongoDB + JEST Integration Testing and how to dockerize the project.</p><p>Prerequisites: basics of node js, express, MongoDB, integration testing, and docker.</p><p>Before going to work with docker I want to set up a basic project with express.js and node.js. Create/Select a folder for our project inter that project through your terminal and run :</p><pre>$ npm init</pre><p>Now it will ask you some questions about package name, version, entry point etc. Hit enter if you want to keep the default one. After that, you will get something like that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*eH_VmoFa6qoNMIERkItmMQ.png" /></figure><p>press ‘yes’ and you are ready to go. It creates a file name package.json.</p><p>Now I would like to add some dependencies :</p><pre>$ npm i express mongoose passport passport-jwt jsonwebtoken body-parser bcryptjs validation</pre><p>copy the whole command or type it and hit the enter button and you will see something like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CfWcj-5oIYj25BYp9hhq5Q.png" /></figure><p><strong>express</strong>: which is our main framework.</p><p><strong>mongoose</strong>: which is used to connect/interact with MongoDB.</p><p><strong>passport</strong>: which is used for authentication.</p><p><strong>jsonwebtoken</strong>: is used for generating the token.</p><p><strong>body-parser</strong>: by using this we can get the data throughout the request.</p><p><strong>validator</strong>: is used for validation.</p><p>Now I want to add a dev-dependency ( nodemon ). If you don’t want to add then you can skip this, it’s optional.</p><pre>$ npm i -D nodemon</pre><p><strong>Nodemon</strong> is a utility that will monitor for any changes in your source and automatically restart your server.</p><p>At that point, your package.json should look like that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7zrMAVbpu07eqH66DzvW6Q.png" /><figcaption>package.json</figcaption></figure><p>Now create a file name app.js ( entry point ). You can create this from the project folder by the command below ( it works for mac)</p><pre>$ touch app.js</pre><p>paste the code below,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90a49d78cecbeded9f9184cd39582007/href">https://medium.com/media/90a49d78cecbeded9f9184cd39582007/href</a></iframe><p>Now, run the command</p><pre>$ node app</pre><p>you will see, Server running on port 8082. you can also check it from the browser. Open the browser and hit at <a href="http://localhost:8082/">http://localhost:8082</a></p><p>now, if we change anything then we need to restart the server manually. but if we set the nodemon then we don’t have to restart it every time. Nodemon will watch if there is any change then it will restart automatically. so what you need to do for that is a little change in the package.json file ( change the scripts ). see the package.json file below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fdc7dbd8a87dc8739460a22e7e923922/href">https://medium.com/media/fdc7dbd8a87dc8739460a22e7e923922/href</a></iframe><p>So, now you can run your project using this command</p><pre>$ npm run app</pre><p>Let’s complete our database setup. I’ll create a mongo instance from the docker a bit later but I want to complete the setup code for database connection before going to the docker-compose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65b32ec5fd8b9fe7d03268096655ecb6/href">https://medium.com/media/65b32ec5fd8b9fe7d03268096655ecb6/href</a></iframe><p>create a folder named config and add three files with the corresponding code mentioned above. keys_dev.js exports the database for the development purpose and the keys_test.js exports the database for the testing purpose and keys.js decides which database to export when. Now update your app.js file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57251a8d6b09619848839d05aa46589c/href">https://medium.com/media/57251a8d6b09619848839d05aa46589c/href</a></iframe><p>So far so good. now, we are ready to go for the docker setup. Create three files ( <strong>Dockerfile</strong>, <strong>docker-compose.yml</strong> and <strong>.dockerignore</strong> ) in the root folder with the code mentioned below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93a99646c998ad43141647d5ab2912a7/href">https://medium.com/media/93a99646c998ad43141647d5ab2912a7/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c04623dd2503b6031805096d077458a/href">https://medium.com/media/0c04623dd2503b6031805096d077458a/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/511e647700f97f456055dbf018fc2700/href">https://medium.com/media/511e647700f97f456055dbf018fc2700/href</a></iframe><p>now you can run your project using the command</p><pre>$ docker-compose up</pre><p>also you can access mongo and app instances using these command</p><pre>// app<br>$ docker-compose exec app bash</pre><pre>// mongo<br>$ docker-compose exec mongo bash</pre><p>If you want to remove the docker container then use</p><pre>$ docker-compose down</pre><p>Now, time to complete route setup. we will see how to create user registration, login and logout APIs. So, let’s create a folder named <strong>routes. </strong>Inside the routes folder create another folder named api, which is going to hold all your APIs. So create a file named <strong>user.js</strong> inside the api folder with the code below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6eb8aeb7a9020f8f72c0973cad4655d3/href">https://medium.com/media/6eb8aeb7a9020f8f72c0973cad4655d3/href</a></iframe><p>To access this file from the app.js (root point) we need to update our app.js file with the code below</p><pre>// initializing routes<br>const users = require(&#39;./routes/api/users&#39;);<br>.<br>.<br>.<br>// use Routes<br>app.use(&#39;/api/users&#39;, users);</pre><p>and your app.js file should be like this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73154a5891a9f46a2bc8abf17ed27067/href">https://medium.com/media/73154a5891a9f46a2bc8abf17ed27067/href</a></iframe><p>Now we can access our users route through <a href="http://localhost/api/users/test">http://localhost/api/users/test</a></p><p>Before going to register user we need to create user model so that we can store user information to the database. Let’s create a folder named <strong>models</strong> and inside it create another file named <strong>User.js</strong> with the code below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/803070af583dbcae0cc242e6ee45dd5c/href">https://medium.com/media/803070af583dbcae0cc242e6ee45dd5c/href</a></iframe><p>Let’s create a register route with proper logical code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61910237b3552e90983bbd6711a57a85/href">https://medium.com/media/61910237b3552e90983bbd6711a57a85/href</a></iframe><p>also, need to update our app.js ( root pointer ) file with the code below</p><pre>const bodyParser = require(&#39;body-parser&#39;);<br>.<br>.<br>const app = express();<br>.<br>.<br>// Body parser middleware<br>app.use(bodyParser.urlencoded({ extended: false }));<br>app.use(bodyParser.json());</pre><p><strong>NOTE</strong>: and the rest will be published soon …</p><p>See the full source code <a href="https://goo.gl/2rHaB9">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f384e06734a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>