<?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 Harshal Deshpande on Medium]]></title>
        <description><![CDATA[Stories by Harshal Deshpande on Medium]]></description>
        <link>https://medium.com/@harshal-deshpande?source=rss-9797f28758a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cjRMqZL5emG4Hax4fxnc9w.jpeg</url>
            <title>Stories by Harshal Deshpande on Medium</title>
            <link>https://medium.com/@harshal-deshpande?source=rss-9797f28758a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:46:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harshal-deshpande/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[Integrate Google ReCaptcha v2 with React and Node.js]]></title>
            <link>https://javascript.plainenglish.io/integrate-google-recaptcha-v2-invisible-with-react-and-nodejs-9d119c94433b?source=rss-9797f28758a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d119c94433b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Harshal Deshpande]]></dc:creator>
            <pubDate>Mon, 18 Oct 2021 07:15:38 GMT</pubDate>
            <atom:updated>2021-10-19T18:17:31.477Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*r2-0JWHyzyPdeY_H1hZ0vg.png" /></figure><p>In this tutorial, we will be walking through the process of integrating reCAPTCHA v2 (invisible) with React and Node.js using npm package <a href="https://www.npmjs.com/package/react-google-recaptcha">react-google-recaptcha</a>.</p><h4>Step 1. Generating keys for google recaptcha</h4><p>To use Google reCAPTCHA service, first we need to register our application and get a site key and private key pair.</p><p>For this, we do the following:</p><ol><li>Visit the Google reCAPTCHA <a href="https://www.google.com/recaptcha/admin/">admin console</a>.</li><li>Click the ‘+’ icon to register a new site/application.</li><li>Select captcha version as reCAPTCHA v2 and type as invisible.</li><li>Copy your site and private keys for further use.</li><li>Add domain of your application in the allowed domains list. For development purposes add <em>Localhost(case sensitive) to </em>the list.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9Au0b0KS4VMW1K2ii6J5Q.png" /></figure><h4>Step 2. Setting up the client-side</h4><p>Install <a href="https://www.npmjs.com/package/react-google-recaptcha">react-google-recaptcha</a> package using npm or yarn.</p><pre>npm install react-google-captcha<br>OR<br>yarn add react-google-captcha</pre><ol><li>Import the &lt;ReCaptcha/&gt; Component</li><li>Include it in your return method.</li><li>You will also require a<em> </em><em>ref</em> to this component.</li><li>Get the recaptcha token using the <em>ref</em> and executeAsync() function (Before submitting your data to the backend)</li><li>Finally, reset the captcha. This is imp for making recaptcha ready for a subsequent check if required (eg:- If username or password was invalid while logging in captcha should reset before retrying)</li></ol><p>Below is some sample React code for this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/738b4fcdcce5f8e19ded1951dfa87daa/href">https://medium.com/media/738b4fcdcce5f8e19ded1951dfa87daa/href</a></iframe><p>For <em>I’m not a robot checkbox </em>captcha, just remove the size prop(line 33) and replace line 9 with recaptchaRef.current.getValue()</p><p><strong><em>Note:</em></strong><em> The recaptcha challenge will be invoked implicitly if Google detects some suspicious user activity. You cannot explicitly invoke the challenge or alter probability of it. To increase probability of the challenge being invoked(for testing purposes maybe) try launching the application in Incognito mode along with a VPN connection.</em></p><p>The package also provides optional props like theme, position of the badge, etc. Check out the package docs for <a href="https://www.npmjs.com/package/react-google-recaptcha">this</a>.</p><h4>Step 3. Verifying the token at the backend</h4><p>Extract the token from the request body and send this token along with the private key obtained in Step1 to Google’s API for obtaining users score.</p><pre>https://www.google.com/recaptcha/api/siteverify?secret=${YOUR_PRIVATE_KEY}&amp;response=${token}</pre><p>You will receive a JSON object with a success key. This key can be used to determine if request came from a genuine user or a suspected bot. Success true means a genuine user.</p><pre>data: {<br> success: true,<br> challenge_ts: ‘2021–10–18T04:33:00Z’,<br> hostname: ‘localhost’<br>}</pre><p>Below is a sample code snippet for the backend:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6df6d0314291a3eded47a68365b16a7c/href">https://medium.com/media/6df6d0314291a3eded47a68365b16a7c/href</a></iframe><p><strong><em>Note:</em></strong><em> Before pushing your code to a public repository remember to remove your private key from the code. You can store it in a environment variable and access it using process.env object or config vars(if deploying with heroku). And add your .env file to .gitignore.</em></p><p>And that’s it! I hope you have found this useful. If so, be sure to let me know in the comments.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d119c94433b" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/integrate-google-recaptcha-v2-invisible-with-react-and-nodejs-9d119c94433b">Integrate Google ReCaptcha v2 with React and Node.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CORS (Cross-Origin Resource Sharing) and How to Fix the CORS Error?]]></title>
            <link>https://javascript.plainenglish.io/what-is-cors-cross-origin-resource-sharing-and-how-to-fix-the-cors-error-d10130e99dd0?source=rss-9797f28758a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/d10130e99dd0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Harshal Deshpande]]></dc:creator>
            <pubDate>Wed, 19 May 2021 15:12:28 GMT</pubDate>
            <atom:updated>2021-10-21T12:33:53.902Z</atom:updated>
            <content:encoded><![CDATA[<h4>Finally, get rid of the CORS error.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z6WIIQrsLK1GcSJW" /><figcaption>Photo by <a href="https://unsplash.com/@elisa_ventur?utm_source=medium&amp;utm_medium=referral">Elisa Ventur</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>What is same-origin policy and CORS?</h4><p>Cross-origin resource sharing is a mechanism that allows websites on one URL to request data from another URL. For example, you try to fetch data from an API and the application fails with a cors error in the console. That happens because the browser implements the <em>same-origin policy</em>. This policy allows clients to freely request data from their own URL but blocks anything from a different URL unless certain conditions are met.</p><p>When a browser makes a request to a server it adds an origin header Origin: <a href="https://localhost:3000/">https://localhost:3000</a> to the request. If this request goes to a server with the same origin, it is allowed by the browser. But if the request goes to a different URL, called as a <em>cross-origin request </em>then, the server must add a <em>Access-Control-Allow-Origin </em>header to the response message. The browser will then match this header with the Origin. In case of a mismatch, the browser will reject the response throwing a cors error. This is the <em>same-origin</em> policy and it is implemented to prevent <em>cross-site request forgery attacks </em>in which malicious websites take advantage of the browser’s cookie storage system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*7Lp4qegQyeTMhJCI-EyXWA.jpeg" /><figcaption>This is what the CORS error looks like.</figcaption></figure><p>When working with APIs and or hosting this error often troubles developers. Below are some of the methods to resolve this issue.</p><h4>Scenario 1 — Building a full-stack application</h4><p>Everything seems to be working fine in the development environment because you are running the server and client programs on the same machine. However, when you deploy your server(using Heroku or some other service) and then try to request data, Snap! the cors error kicks in.</p><p>Good news… The fix is really easy. You just need to add the Access-Control-Allow-Origin header to the server responses.</p><blockquote>response.header(&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;)</blockquote><p>Here, the ‘*’ specifies the wildcard value to allow all domains to access the server resources. The server can also be very specific, and only include the origin URL of the domain that can access the resources in the header.</p><p><strong>— Alternative solution: using the cors package.</strong></p><blockquote>Installation — npm install cors</blockquote><blockquote>Import — const cors = require(&#39;cors&#39;)</blockquote><blockquote>Add middleware to your server — app.use(cors())</blockquote><p>You can configure the cors options and even add it to only specific endpoints instead of all the responses. Check out the package documentation <a href="https://www.npmjs.com/package/cors">here</a>.</p><h4>Scenario 2 — Fetching data from a third-party API at the frontend</h4><p>Say your frontend is trying to make a GET request to the <a href="https://jobs.github.com/api">GitHub Jobs API</a>. But this API does not include a Access-Control-Allow-Origin header in the response resulting in a cors error.</p><p><strong>— Solution1: send your request to a fetch proxy (quick-fix)</strong></p><p>The proxy server acts as a middleware between the client and the API. The GET request first goes to the proxy that adds the Access-Control-Allow-Origin header and forwards the request to the client.</p><p>There are many free proxy servers to choose from like<a href="https://cors-anywhere.herokuapp.com/corsdemo"> cors anywhere</a>, <a href="https://github.com/Freeboard/thingproxy">thingproxy</a>, etc. To use a fetch proxy, append the proxy URL to the API request. See the example below:</p><blockquote>Previous — axios.get(https://jobs.github.com/positions.json)</blockquote><blockquote>Modified — axios.get(https://cors-anywhere.herokuapp.com/https://jobs.github.com/positions.json)</blockquote><p>Here is a <a href="https://nordicapis.com/10-free-to-use-cors-proxies/">list of 10 free proxy servers</a> you could use. This solution is great due to its ease of implementation. However, most of these proxies are for development purposes only and either provide only a demo for temporary use or won’t work in a production environment. Also, it often takes a while to receive a response affecting the performance of the application.</p><p><strong>— Solution2: build your own proxy server</strong></p><p>Don’t worry it’s much easier than it sounds and the best solution as well as building your own proxy gives you more flexibility and control into its design and implementation. Build a simple server that fetches data from the API and servers the same data to your frontend meanwhile adding the Access-Control-Allow-Origin header to the response. Here is an example of a Node proxy for fetching data from the GitHub Jobs API using restify.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ddb2b356c4fb80ea30d2cfe8e81c7ff/href">https://medium.com/media/2ddb2b356c4fb80ea30d2cfe8e81c7ff/href</a></iframe><p>HTTP requests with non-standard headers (Put, Patch, Delete) need to be pre-flighted. The browser first makes a request with the options HTTP verb to which the server responds with the allowed methods for that Origin using the header Access-Control-Allow-Methods: PUT after which the actual request can be sent. The server can respond with a Access-Control-Max-Age: 30000 header allowing the browser to cache the preflight for a certain amount of time making the process more efficient.</p><p><strong>Some temporary fixes —</strong></p><ul><li>Add &quot;proxy&quot;: &quot;API_URL&quot; to the package.json file and modify the fetch query to send request to ‘/’</li><li>Install the Allow-Control-Allow-Origin browser plugin.</li></ul><p><strong>Disclaimer:</strong> These solutions work only in development and would fail in production environments.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d10130e99dd0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/what-is-cors-cross-origin-resource-sharing-and-how-to-fix-the-cors-error-d10130e99dd0">What is CORS (Cross-Origin Resource Sharing) and How to Fix the CORS Error?</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A 2021 Roadmap to Becoming a Frontend Web Developer]]></title>
            <link>https://javascript.plainenglish.io/roadmap-to-become-a-frontend-web-developer-in-2021-ee06abb21489?source=rss-9797f28758a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee06abb21489</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Harshal Deshpande]]></dc:creator>
            <pubDate>Sun, 16 May 2021 08:33:56 GMT</pubDate>
            <atom:updated>2022-11-30T11:24:12.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNz6L9LH-OB6dmeKQBlLxA.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@antonio-batinic-2573434?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Antonio Batinić</a> from <a href="https://www.pexels.com/photo/black-screen-with-code-4164418/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>Frontend web development, also known as client-side development, is the practice of creating the user interface for web applications that users can see and interact with directly. Frontend development is a really good starting point to land your very first job as a software engineer. This guide will walk you through a series of steps to become a frontend developer from the ground up.</p><h4>What exactly do frontend developers do?</h4><p>It’s a misconception that frontend developers just write CSS forever, there’s much more to it. As a frontend developer, you will most probably be working on one of the following:</p><ul><li>Designing layouts</li><li>Styling</li><li>State management</li><li>Handling and rendering asynchronous data</li></ul><p>The following steps will help you to get going from scratch.</p><h3>1. Learn HTML</h3><p><strong>HTML</strong> (Hypertext Markup Language) is the most basic building block of any webpage. It defines the meaning and structure of web content. You don’t need to learn every single detail about HTML or every tag. Here are some key points you should focus on:</p><ul><li>The basic construction of an HTML page</li><li>Adding and formatting text in HTML</li><li>Creating lists, tables, and forms</li><li>Embedding links, images, and videos</li></ul><blockquote><strong>Resources</strong></blockquote><blockquote><a href="https://html.com/">Article to learn HTML</a> by html.com</blockquote><h3>2. Learn CSS</h3><p>Now that we have various elements added to our page using HTML, we need to style them using CSS (Cascading Style Sheets). CSS describes how HTML elements should be displayed. Following are some important concepts:</p><ul><li>CSS selectors (to select a specific or group of HTML elements)</li><li>Units in CSS (absolute pixel values, percentage, em+rem, vh+vw)</li><li>CSS positioning (static, relative, absolute, fixed, sticky)</li><li><strong>CSS box model</strong></li><li><strong>CSS Flexbox</strong></li><li><strong>CSS grids</strong></li></ul><blockquote><strong>Tips and tricks</strong></blockquote><blockquote>Remove any default margins and padding from the webpage</blockquote><blockquote>Use Clamp instead of media queries</blockquote><blockquote>Use relative units instead of absolute to make your page responsive</blockquote><pre>*{ <br>  padding: 0; <br>  margin: 0;<br>  box-sizing:border-box;<br>}</pre><blockquote><strong>Resources</strong></blockquote><blockquote><a href="https://www.youtube.com/playlist?list=PLZlA0Gpn_vH9D0J0Mtp6lIiD_8046k3si">Learn CSS youtube playlist</a> by Web Dev Simplified</blockquote><h3>2.1 CSS Frameworks</h3><p>This is an optional step but can be a great tool to create websites and UIs quickly. CSS frameworks provide you with readymade templates/components and classes that you can import into your codebase and get beautiful responsive components without writing any CSS.</p><p>Some popular choices (choose one) would be:</p><ul><li>Tailwind CSS</li><li>Bootstrap5</li><li>Materialize</li><li>Bulma</li></ul><h3>3. Learn JavaScript</h3><p>Now you can create beautiful web pages with HTML and CSS. But how do you make it functional? How do you actually submit the form on a button click or update contents dynamically on certain events? The answer is <strong>JavaScript.</strong></p><p>JavaScript is a scripting language that can be used to write both client-side code (code that runs in the browser) and server-side code (with Node.js and Deno). You can write an entire application using just a single language, thus making the development experience smooth and speeding up the application. This is why JavaScript is so popular and a must-learn for any aspiring developer.</p><p><strong>Basic JavaScript</strong></p><ul><li>Variables, data types, loops, and functions</li><li>JavaScript objects and the “this” keyword</li><li>Document Object Model (DOM)</li><li>The difference between var/let/const keywords</li><li>Array methods (foreach, map, filter, reduce, etc.)</li></ul><p><strong>Advanced concepts</strong></p><p>Once you are done with the basics, following the advanced concepts of JavaScript will help to make code efficient and concise and also help to fetch data from APIs and render it. These are some advanced concepts you should familiarize yourself with:</p><ul><li><strong>ES6</strong> features like arrow functions, template literals, destructuring</li><li>Callbacks and promises</li><li>Asynchronous programming (async/await)</li><li><strong>The Fetch API</strong></li></ul><blockquote><strong>Resources</strong></blockquote><blockquote><a href="http://arn%20javascript%20-%20full%20course%20for%20beginners/">Learn JavaScript — Full Course for Beginner</a>s by freeCodeCamp</blockquote><blockquote><a href="https://www.interviewbit.com/javascript-interview-questions/">JavaScript interview questions</a> by interviewbit</blockquote><h3>4. JavaScript Frameworks</h3><p>JavaScript frameworks make developers’ lives easier by providing code libraries, setting up boilerplate code, and providing common features to build web applications.</p><p>The most popular frameworks today are React, Angular, Vue.js. It’s not recommended to try and learn everything. Choose any one of them. React and Vue.js are comparatively easier to learn but have fewer features; whereas Angular has a ton of features but a steeper learning curve.</p><p>React is an open-source library maintained by Facebook. It is in great demand, is easy to learn, has a great community (you would find solutions to even the rarest problems on Stack Overflow), and has good documentation. Hence, it could be a great choice. The following article may bring more clarity as to which framework may best suit your requirement.</p><p><a href="https://medium.com/swlh/vue-vs-react-vs-angular-what-framework-would-you-choose-5d77a3680b0d">Vue vs React vs Angular: What Framework Would You Choose?</a></p><blockquote><strong>Resources</strong></blockquote><blockquote><a href="https://reactjs.org/docs/getting-started.html">https://reactjs.org/docs/getting-started.html</a> — official documentation</blockquote><blockquote><a href="https://www.youtube.com/watch?v=QFaFIcGhPoM&amp;list=PLC3y8-rFHvwgg3vaYJgHGnModB54rxOk3">React tutorial playlist</a> by Codevolution</blockquote><blockquote><a href="https://youtu.be/2OHbjep_WjQ">Learn Angular — Full Tutorial Course</a></blockquote><blockquote><a href="https://youtu.be/4deVCNJq3qc">Learn Vue.js — Full Course for Beginners</a></blockquote><h3>5. Learning Git</h3><p>By far, the most widely used modern version control system in the world is Git. Version control is an important skill that every web developer must be familiar with.</p><p>Git is a command-line tool, but the center around which all things involving Git revolve is the hub — GitHub.com — where developers store their projects and network with like-minded people. After learning git, you can contribute to open-source projects on Github. By contributing to open-source projects, you will learn a lot and it will help to build an online presence.</p><blockquote><strong>Resources</strong></blockquote><blockquote><a href="https://www.youtube.com/watch?v=RGOj5yH7evk">Git and Github crash course</a> by freeCodeCamp</blockquote><blockquote><a href="https://www.youtube.com/watch?v=E8hhHKlq6rk">What is git and how to use it</a> by simplilearn</blockquote><p>At this point, you are ready to apply for your first job as a frontend developer. The following steps will help you to learn some advanced concepts to make your profile stand out from the rest.</p><h3>6. Global State Management</h3><ul><li>React: Context API, Redux, MobX</li><li>Angular: Shared service, NgRx</li><li>Vue.js: Vuex</li></ul><h3>7. Server-side Rendering</h3><ul><li>React: Next.js</li><li>Vue.js: Nuxt.js</li><li>Angular universal (Angular)</li></ul><h3>8. Optional</h3><ul><li>Learn deployment and host your projects (Netlify, Github pages, Heroku).</li><li>Learn <strong>TypeScript</strong> (brings a “strict” type system to JavaScript). It makes your code more robust and less prone to errors. Great for larger projects.</li><li><strong>Firebase</strong> could be really helpful to build full-stack applications as a frontend developer without requiring much knowledge about the backend and databases, and with minimal server-side code. It also provides free hosting.</li><li>Learn some testing frameworks (like Jest and Mocha for JavaScript).</li><li>Build a portfolio website to display your work and projects.</li></ul><p><strong>Congratulations!</strong> You are now a frontend developer.</p><p><em>More content at </em><a href="http://plainenglish.io/"><em>plainenglish.io</em></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><em>free weekly newsletter</em></a><em>. Get exclusive access to writing opportunities and advice in our </em><a href="https://discord.gg/GtDtUAvyhW"><em>community Discord</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee06abb21489" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/roadmap-to-become-a-frontend-web-developer-in-2021-ee06abb21489">A 2021 Roadmap to Becoming a Frontend Web Developer</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>