<?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 Shanya Verma on Medium]]></title>
        <description><![CDATA[Stories by Shanya Verma on Medium]]></description>
        <link>https://medium.com/@shanyavermaofficial?source=rss-af241975cd3a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*B_b_gKAKYQvnYewaOCz7pQ.jpeg</url>
            <title>Stories by Shanya Verma on Medium</title>
            <link>https://medium.com/@shanyavermaofficial?source=rss-af241975cd3a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:21:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shanyavermaofficial/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[What are JSON Web Tokens (JWTs) and how to use them?]]></title>
            <link>https://medium.com/@shanyavermaofficial/what-are-json-web-tokens-jwts-and-how-to-use-them-90621b747c94?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/90621b747c94</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[jwt-token]]></category>
            <category><![CDATA[json-web-token]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 15:14:37 GMT</pubDate>
            <atom:updated>2023-10-24T15:14:37.151Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will discuss how to carry out authentication in your MERN app.</p><h4>How authentication works?</h4><p>First, let’s talk about the whole process of authentication and how it works:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*TRPtyKcQ754782JiSTqmrw.png" /></figure><ol><li>The client sends the authentication data like the email and password to the server</li><li>The server returns a token to the client which is generated on the server. Thus, it contains some information that can only be validated by the server</li><li>This token will then be stored in the client, that is, in the browser storage.</li><li>The client can then attach this token to every subsequent request it sends to the server.</li><li>This token can only be validated by the server which created the token.</li></ol><h4>What is this token?</h4><p>Now let’s talk about what this token contains.</p><p>This token contains JSON data and a signature which is generated on the server with a special private key which is only stored on the server.</p><p>And this gives us a JWT.</p><p>JSON Data + Signature = JSON Web Token (JWT)</p><h4>How to create a JSON web token</h4><p>Let us discuss how you can create a JSON web token:</p><ol><li><strong>Install a package</strong> called jsonwebtoken using- npm install <strong>jsonwebtoken</strong></li><li>This will help us to create the web token conveniently</li><li><strong>Import the package</strong> in your authentication controller file:</li></ol><pre>const jwt= require(&quot;jsonwebtoken&quot;);</pre><p>4. This is what my login controller function currently looks like (for the post login route):</p><pre>exports.login = async (req, res, next) =&gt; {<br>  const { email, enteredPassword } = req.body;<br><br>  try {<br>    const findUser = await User.findOne({ email });<br>    if (findUser) {<br>      const doMatch = await bcrypt.compare(enteredPassword, findUser.password);<br>      if (doMatch) {<br>        res.send(&quot;Password is correct&quot;);<br>      } else {<br>        res.send(&quot;Password is incorrect&quot;);<br>      }<br>    } else {<br>      res.send(&quot;User doesn&#39;t exist! Please sign up&quot;);<br>    }<br>  } catch (err) {<br>    console.log(err);<br>  }<br>};</pre><p>Now, we will <strong>generate a token</strong> in this login controller function:</p><pre>exports.login = async (req, res, next) =&gt; {<br>  const { email, enteredPassword } = req.body;<br><br>  try {<br>    const findUser = await User.findOne({ email });<br>    if (findUser) {<br>      console.log(&quot;user found&quot;);<br>      const doMatch = await bcrypt.compare(enteredPassword, findUser.password);<br>      if (doMatch) {<br>        console.log(&quot;password matched&quot;);<br>        //create token<br>        const token = jwt.sign(<br>          {<br>            email,<br>            userId: findUser._id.toString(),<br>          },<br>          &quot;thisisasupersecretsecretkey&quot;,<br>          {<br>            expiresIn: &quot;1h&quot;,<br>          }<br>        );<br>        res.status(200).json({ token, userId: findUser._id.toString() });<br>      } else {<br>        console.log(&quot;password not matched&quot;);<br>        res.send(&quot;Password is incorrect&quot;);<br>      }<br>    } else {<br>      res.send(&quot;User doesn&#39;t exist! Please sign up&quot;);<br>    }<br>  } catch (err) {<br>    console.log(err);<br>  }<br>};</pre><p>The secret key added here is just for reference. The best practice is to use environment variables.</p><p>The sign method will create a new signature and packs that into a new JSON web token and we have stored some data into the token (email and userId).</p><p>As stated earlier, I am using MongoDB and since the user “_id” is a mongoDB object ID here, I have converted that to a string.</p><p>In the second argument, we have passed a secret, that is, that private key which is used for logging in.</p><p>In the third argument, we have set an expiry time of one hour so that the token becomes invalid after one hour. Now this is a security mechanism you should add because the token is stored in the client and it could be stolen.</p><p>Next, I have returned the response to the client with a status code of 200 and sent the token, along with the userId.</p><h4>Save the token in client</h4><p>We have received the token from the backend. Now lets save that token in the local storage by:</p><pre>localStorage.setItem(&quot;token&quot;, response.data.token);</pre><p>Add this in your client-side login handler function.</p><h4>Attaching the token while sending requests</h4><p>Now that we are generating a token, passing it to the client and also storing it in our local storage, we need to make sure that the client can pass back the token to the backend. We will do this with the use of a header.</p><p>For example, this is how I will send the token in my get request for fetching the details of a product:</p><pre>const fetchProductDetailToEdit = async () =&gt; {<br>        try {<br>          const url = `/product/${productId}`;<br>          const token = localStorage.getItem(&quot;token&quot;);<br>          const response = await axios.get(url, {<br>            headers: {<br>              Authorization: &quot;Bearer &quot; + token,<br>            },<br>          });<br>          console.log(response);<br>          const title = response.data.title;<br>          const description = response.data.description;<br>          const price = response.data.price;<br>          const image = response.data.image;<br><br>          setTitle(title);<br>          setDescription(description);<br>          setImage(image);<br>          setPrice(price);<br>        } catch (err) {<br>          window.alert(&quot;Not able to authenticate&quot;);<br>          console.log(err);<br>        }<br>      };</pre><h4>Using and validating the token</h4><p>Now lets extract this token sent by the client and check the validity of the token. That is, if no token is attached to the incoming requests that require authentication, we can just block the access here.</p><p>For this, we will add a new middleware:</p><pre>const jwt = require(&quot;jsonwebtoken&quot;);<br><br>module.exports = (req, res, next) =&gt; {<br>  const authHeader = req.get(&quot;Authorization&quot;);<br>  if (!authHeader) {<br>    const error = new Error(&quot;Not authenticated&quot;);<br>    error.statusCode = 401;<br>    throw error;<br>  }<br>  const token = authHeader.split(&quot; &quot;)[1];<br>  let decodedToken;<br>  try {<br>    decodedToken = jwt.verify(token, &quot;thisisasupersecretsecretkey&quot;);<br>  } catch (err) {<br>    console.log(err);<br>    res.statusCode = 500;<br>    throw err;<br>  }<br>  if (!decodedToken) {<br>    const error = new Error(&quot;Not authenticated&quot;);<br>    error.statusCode = 401;<br>    throw error;<br>  }<br>  req.userId = decodedToken.userId;<br>  next();<br>};</pre><h4>Add the middleware to the routes</h4><p>Now, we will add this middleware to our get product route:</p><pre>router.get(&quot;/product/:productId&quot;, isAuth, productController.getProduct);</pre><h4>Remove token</h4><p>Don’t forget to remove the item once you log out!</p><pre>localStorage.removeItem(&quot;token&quot;);</pre><h4>That’s all!</h4><p>Now, when we will try to access this route without sending the valid token, we will get a window alert saying “Not authenticated”.</p><p><strong>Please note</strong> that window alert is just for reference here. It is recommended to use a modal to show any errors or messages for better user experience.</p><p>Hope you found this helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90621b747c94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are CORS Errors and how to fixthem?]]></title>
            <link>https://medium.com/@shanyavermaofficial/what-are-cors-errors-and-how-to-fixthem-7932063f7084?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7932063f7084</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Fri, 20 Oct 2023 08:28:03 GMT</pubDate>
            <atom:updated>2023-10-22T12:19:10.448Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are CORS Errors and how to fix them?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*JjsCYxEWmZLhYtS3C2S0wg.png" /></figure><p>As a developer, you all must have seen this error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*DN6Hp3bQA231Zhhu0T88Og.jpeg" /></figure><p>This error is also called a CORS error as you can see in the error message above.</p><h4>What is CORS?</h4><p>CORS stands for Cross Origin Resource Sharing and by default, this is not allowed by browsers.</p><p>So if our client and the server run in the same domain or server, for example, localhost:3000, we can send requests and responses as we want to without issues.</p><p>However if client server run on different domains like the client on localhost:3000 and the server on localhost:8080, then we’ll get a CORS error because it’s a security mechanism provided by the browser that you can’t share resources across domains or servers.</p><p>However we can overwrite this because this mechanism makes sense for some applications, but not for REST APIs.</p><h4>How to fix it?</h4><p>You can fix the CORS error by going to your server-side code and adding some special headers.</p><p>Since we want these headers on any response that leaves our server, we’d do this in the app.js file and add a general middleware before forwarding the requests to your routes.</p><pre>//app.js<br><br>const express = require(&#39;express&#39;);<br><br>const feedRoutes = Require(&#39;./routes/feed&#39;);<br><br>const app = express();<br><br>app.use((req, res, next) =&gt; {<br>   res.setHeader(&#39;Access-Control-Allow-Origin&#39;, &#39;*&#39;);<br>   res.setHeader(&#39;Access-Control-Allow-Methods&#39;, &#39;GET, POST, PUT, PATCH, DELETE&#39;);<br>   res.setHeader(&#39;Access-Control-Allow-Headers&#39;, &#39;Content-Type, Authorization&#39;);<br>   next();<br>});<br><br>app.use(&#39;/feed&#39;, feedRoutes);<br><br>app.listen(8080);</pre><p><strong>Access-Control-Allow-Origin</strong></p><p>This is the first header we need to set to all the domains that should be able to access our server. ‘*’ allows access from any client.</p><p>You could lock it down to specific domains though if you wanted to.</p><p><strong>Access-Control-Allow-Methods</strong></p><p>In the above header we allowed a specific origin to access our content, now we allow these origins to use specific http methods. We meed to tell the origins which methods are allowed. Again, you can only add the methods you want.</p><p><strong>Access-Control-Allow-Headers</strong></p><p>Here also we can add a wildcard (‘*’) or specify specific headers.</p><p>Content-Type, Authorization header is added so that your clients can send requests that hold extra authorisation data in the header.</p><p><strong>And now, every response that we send will have the above headers.</strong></p><p>Hope you found this helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7932063f7084" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to encrypt passwords before storing in database]]></title>
            <link>https://medium.com/@shanyavermaofficial/how-to-encrypt-passwords-before-storing-in-database-80ed18be4aa3?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/80ed18be4aa3</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mern-stack]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Sun, 15 Oct 2023 18:43:03 GMT</pubDate>
            <atom:updated>2023-10-16T10:30:33.966Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2qK2WCLX3Clwot2vCtt-Q.png" /><figcaption>How to encrypt passwords before storing in database</figcaption></figure><p>One of the biggest mistakes you can do as a programmer is storing the users’ passwords in plain text! If your database gets compromised, all of the passwords will be exposed.</p><p>Hence, you should be hashing the passwords before storing them in such a way that it is non-reversible.</p><p>For this, you can use a package called bcrypt and achieve this in under 2 minutes!</p><h3>Let’s begin</h3><h4>Installation</h4><pre>npm install bcrypt</pre><h4>Import</h4><p>Import bcrypt in your controller file:</p><pre>const bcrypt = require(&quot;bcrypt&quot;);</pre><h4>Code setup and Usage</h4><p>I will be hashing the user’s password in my signup controller function which currently looks like this:</p><pre>exports.signup = async (req, res, next) =&gt; {<br>  const { email, password, confirmPassword } = req.body;<br>  try {<br>    const user = new User({<br>      email,<br>      password,<br>      cart: {items: [] },<br>    });<br>    const response = await user.save();<br>    console.log(response);<br>    res.send(&quot;User created&quot;);<br>  } catch (err) {<br>    console.log(err);<br>    res.send(err);<br>  }<br>};</pre><p>As you can see, currently I am storing the user’s password as a text in my mongoDB database which is a complete no go!</p><p>Using bcrypt:</p><pre>exports.signup = async (req, res, next) =&gt; {<br>  const { email, password } = req.body;<br>  try {<br>    const hashedPassword = await bcrypt.hash(password, 12);<br>    const user = new User({<br>      email,<br>      password: hashedPassword,<br>      cart: {items: [] },<br>    });<br>    const response = await user.save();<br>    console.log(response);<br>    res.send(&quot;User created&quot;);<br>  } catch (err) {<br>    console.log(err);<br>    res.send(err);<br>  }<br>};</pre><p>The hash method as a first argument takes a string that you want to hash (the password). The second argument is the salt value to specify how many rounds of hashing will be applied. The higher the value, the more time it takes, but it will be much more secure as well.</p><p>This method returns a Promise, hence I have used async-await.</p><h4>Result</h4><p>Now, when I sign up again, the password looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mll_PkMqD7KXy0dMcP2F4Q.png" /></figure><p>And no one can decrypt this.</p><p>Hope you found this helpful!</p><p>For more info- <a href="https://www.npmjs.com/package/bcrypt">https://www.npmjs.com/package/bcrypt</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80ed18be4aa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add Validation using express-validator]]></title>
            <link>https://medium.com/@shanyavermaofficial/how-to-add-validation-using-express-validator-75119f563fd7?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/75119f563fd7</guid>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Sat, 14 Oct 2023 09:46:18 GMT</pubDate>
            <atom:updated>2023-10-14T09:46:18.838Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QnLllQp-DyrRCbN5" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Today we will walk through the steps to implement validation in your Node application using a package called express validator, which is a set of <a href="http://expressjs.com/">express.js</a> middlewares that wraps the extensive collection of validators and sanitisers offered by <a href="https://github.com/validatorjs/validator.js">validator.js</a>.(<a href="https://www.npmjs.com/package/express-validator">https://www.npmjs.com/package/express-validator</a>)</p><p>Official docs- <a href="https://express-validator.github.io/docs/">https://express-validator.github.io/docs/</a></p><h4>Installation</h4><pre>npm install express-validator</pre><h4>How to use</h4><p>I will be showing you how to use this package when you want to validate the user input while signing up.</p><p>For this, I will head over to my routes folder and into my auth.js file, where I am handling all my authentication routes for the application.</p><p>I will start by importing a subpackage from express-validator, which is called check into my auth.js file:</p><pre>const check = require(&quot;express-validator&quot;);<br>const checkFunction = check.check;</pre><p>This returns an object, but we only need the “check” property that holds a function.</p><p>To add validation to a route, you need to add a middleware:</p><pre>router.post(&quot;/signup&quot;, check(&quot;email&quot;).isEmail(), authController.signup);</pre><p>To the check function, you can pass one field or an array of fields that you want to check. Then we call a method on this object which is returned by this check function that now allows us to do all kinds of checks like isEmail.</p><p>And what this will now do is it will use this package to check the email field on the incoming request and it looks for that field in the body, in the query parameters, in the headers and in the cookies. When it finds that field, it checks if that is a valid email address.</p><p>Now that we have our middleware, we can go to our controller here and import another part of the package.</p><pre>const check = require(&quot;express-validator&quot;);<br>const { validationResult } = check;</pre><p>Validation result is a function that allows us to gather all the errors that our validation middleware might have thrown or might have stored.</p><p>Extract errors in my controller function of the post signup route:</p><pre>const errors= validationResult(req);</pre><p>Here I have simply extracted my errors and stored them in a constant by calling validation result on the request. In that request, this express validator middleware will have added errors that can now be retrieved.</p><p>The middleware that we added in our routes files will store some errors it found in an errors object so to say and this validation result function will go through that errors object managed by that middleware on the request and will then collect them all in this errors constant and we can then use that constant to check if we do have errors.</p><p>Check if you do have errors:</p><pre>const errors = validationResult(req);<br>  if (!errors.isEmpty()) {<br>    return res.send(errors.array()[0].msg);<br>  }</pre><p>errors.array() looks like this:</p><pre>[<br> {<br>   type: &#39;field&#39;,<br>   value: &#39;dd&#39;,<br>   msg: &#39;Invalid value&#39;,<br>   path: &#39;email&#39;,<br>   location: &#39;body&#39;<br>}<br>]</pre><p>You can also customise the message in the routes file, that is, where you add the middleware:</p><pre>router.post(<br>  &quot;/signup&quot;,<br>  checkFunction(&quot;email&quot;).isEmail().withMessage(&quot;Please enter a valid email&quot;),<br>  authController.signup<br>);</pre><p>List of other validators- <a href="https://github.com/validatorjs/validator.js">https://github.com/validatorjs/validator.js</a></p><p>You can also add custom validators:</p><pre>router.post(<br>  &quot;/signup&quot;,<br>  checkFunction(&quot;email&quot;)<br>    .isEmail()<br>    .withMessage(&quot;Please enter a valid email&quot;)<br>    .custom((value, { req }) =&gt; {<br>      if (value === &quot;admin@admin.com&quot;) {<br>        throw new Error(&quot;Can&#39;t enter this email&quot;);<br>      }<br>      return true;<br>    }),<br>  authController.signup<br>);</pre><p>Custom is a function that receives the value of the field we’re checking and optionally, an object from which we can extract things like the location to which this was sent, the path or the request.</p><p>This particular dummy function will throw an Error if the user enter “admin@admin.com” as the email and will return true if succeeded.</p><p>Hope you found this helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75119f563fd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to be Productive Working From Home]]></title>
            <link>https://medium.com/@shanyavermaofficial/how-to-be-productive-working-from-home-6fb37766239f?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fb37766239f</guid>
            <category><![CDATA[remote-working]]></category>
            <category><![CDATA[wfh]]></category>
            <category><![CDATA[remote-work]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Thu, 12 Oct 2023 18:00:31 GMT</pubDate>
            <atom:updated>2023-10-12T18:00:31.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1XIOJwsCwoZiMsmw" /><figcaption>Photo by <a href="https://unsplash.com/@mikeyharris?utm_source=medium&amp;utm_medium=referral">Mikey Harris</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I work full-time as a full stack developer for a UK based company and like a lot of people in the corporate world, I have been working remotely since 2020. Switching to this wfh setup has definitely been a big transition but I feel like I have learnt a lot while woirking remotely.</p><p>So let’s begin.</p><h4>Have a good workspace setup</h4><p>It definitely is a long and a bit pricey process to build a healthy and productive work setup for yourself, but it is one of the most important investments you’ll make.</p><p>Let’s say you are just starting with a laptop, so the things that I would add in the order of importance for me will be:</p><ol><li>Desk (duh)</li><li>Wireless mouse and keyboard</li><li>Monitor</li><li>Laptop Stand</li><li>Comfortable Chair</li><li>Desk organiser if you are a pen and paper person to organise your stationery</li></ol><p>I feel these are the minimum to help you get things done relatively quicker, while also taking care of your posture.</p><p>Some other things that I have added on top of these, but are definitely optional:</p><ol><li>A monitor stand or a monitor clamp</li><li>Headphones or earphones for meetings</li><li>Standing desk so that I can take some breaks from sitting for so long</li><li>Some desk decor like plants, lamps, RGB lights, candles. These can play a huge role in uplifting your overall mood</li></ol><p>Most companies also provide with wfh items like laptop, monitor and chair. Do check this out with your HR.</p><h4>Minimise Distractions</h4><p>From household chores to social media notifications, it’s important to identify and minimise potential distractions.</p><ul><li><strong>Turn off notifications</strong>: Silence your phone or put it on “Do Not Disturb” mode to avoid interruptions from messages or social media notifications.</li><li><strong>Create a task list</strong>: Make a to-do list at the beginning of each day to prioritise your tasks and stay organised. This helps to keep you on track and reduces the likelihood of getting sidetracked.</li><li><strong>Use time-management techniques</strong>: Explore productivity techniques such as the Pomodoro Technique, where you work for a focused period of time followed by a short break. This method helps to maintain concentration and prevents burnout.</li></ul><h4>Organise your notes</h4><p>It is a good practice to take notes when in important calls and meetings, but make sure that you have them all in one place. This way you won’t waste your time trying to find that one key piece of information.</p><p>I usually use Notion to organise my notes. It’s a lifesaver, especially if you are dealing with multiple teams like UI/UX, product etc.</p><h4>Block out your calendars</h4><p>How many times has it happened that you spent most of the day in calls (half of which could have been an email btw), and wasn’t able to get much work done? Yeah, probably quite a lot.</p><p>What I like to do is to block out specific parts of my day like my working time for a particular ticket, lunch time etc. This way your colleagues will have an idea that you are planning to do some work at that time and if it’s absolutely crucial, they can always drop a message and you can prioritise accordingly.</p><p>Blocking out your work time is a game changer, especially if yopu’re someone who procrastinates on their tickets. As a result, it will not only help you be more productive, but also encourage you to get your work done much faster.</p><h4>Use virtual collaboration tools</h4><p>This definitely looks different for different teams or companies, but using virtual collaboration tools really help in avoiding confusion also get the work done much faster.</p><p>We use Mural, which is a virtual whiteboard, where you can add sticky notes, images and much more.</p><p>Hope you found this helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fb37766239f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Step-by-Step Guide to Catching Up with Your Studies]]></title>
            <link>https://medium.com/@shanyavermaofficial/a-step-by-step-guide-to-catching-up-with-your-studies-c30c55e4fc0a?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c30c55e4fc0a</guid>
            <category><![CDATA[study-guide]]></category>
            <category><![CDATA[study-tips]]></category>
            <category><![CDATA[catching-up]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Tue, 29 Aug 2023 08:36:07 GMT</pubDate>
            <atom:updated>2023-08-29T08:36:07.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DEmqABIMwWosORJx" /></figure><h4>Introduction</h4><p>As a student, it’s not uncommon to fall behind in your studies at times. Whether it’s due to illness, personal circumstances, or simply a lack of focus, falling behind can create a sense of overwhelm and stress.</p><p>When you fall behind, you miss out on valuable information and concepts that build upon one another. This can create gaps in your understanding, making it difficult to keep up with new material. By catching up, you bridge these gaps and create a solid foundation for continued learning. So, let’s dive into the step-by-step process of catching up and thriving in your studies.</p><h3>Assessing the Current State of Your Studies</h3><ol><li>The first step in catching up on your studies is to assess your current situation.</li><li>Take some time to reflect on the subjects or topics you are struggling with and identify the root causes of your falling behind. Are there specific assignments or chapters you haven’t completed? Are there any concepts that you find particularly challenging? By analyzing why you got left behind, you can better understand the areas that require your immediate attention.</li><li>Make a list of the tasks you need to complete, including assignments, readings, or any missed lectures. Having a visual representation of what needs to be done will help you prioritize your efforts effectively.</li><li>Once you have a clear overview of your academic responsibilities, you can move on to the next step — creating a study schedule.</li></ol><h3>Creating a Study Schedule</h3><ol><li>A study schedule is an essential tool for catching up on your studies. It helps you allocate time for each subject or task, ensuring that you cover all the necessary material.</li><li>Start by identifying the time slots in your daily routine that are most conducive to studying. This could be early mornings, afternoons, or evenings, depending on your personal preferences and commitments.</li><li>Next, assign specific subjects or tasks to each time slot, considering their importance and urgency.</li><li>Be realistic in your planning and allow for breaks to prevent burnout. Remember, it’s better to study effectively for shorter periods than to spend hours without retaining any information.</li><li>Stick to your study schedule diligently, but also remain flexible to accommodate unexpected events or changes in priorities.</li></ol><h3>Prioritising Tasks and Setting Goals</h3><ol><li>With your study schedule in place, it’s time to prioritise tasks and set goals.</li><li>Start by identifying the subjects or assignments that require immediate attention. These could be upcoming exams, deadlines, or topics that are currently being taught. By focusing on these priority tasks first, you ensure that you’re not only catching up but also staying on track with the rest of the class.</li><li>Setting clear goals is also crucial in the catching-up process. Break down larger tasks into smaller, manageable chunks to make progress more tangible and achievable.</li><li>For example, instead of aiming to complete an entire chapter in one sitting, set a goal to read a certain number of pages or understand a specific concept.</li></ol><h3>Utilising Effective Study Techniques</h3><ol><li>Studying smart, not just hard, is key to catching up effectively. There are several proven study techniques that can enhance your learning and retention.</li><li>One such technique is active learning, which involves engaging with the material rather than passively reading or listening. This can be done through activities such as summarising, note-taking, or teaching the concepts to someone else.</li><li>Another effective technique is spaced repetition, where you review information at regular intervals over time. This helps reinforce your memory and prevent forgetting.</li><li>Flashcards or online apps can be great tools for implementing spaced repetition in your study routine.</li><li>Additionally, practicing past exams or solving practice problems can help you familiarise yourself with the types of questions you may encounter and build confidence in your abilities.</li></ol><h3>Managing Your Time Effectively</h3><ol><li>Time management plays a crucial role in catching up on your studies. With a busy schedule and multiple responsibilities, it’s important to make the most of the time you have.</li><li>Apart from allocating specific study slots in your schedule, there are other strategies you can employ to manage your time effectively.</li><li>Firstly, minimise distractions during your study sessions. Put your phone on silent or in another room, and find a quiet study environment where you can focus.</li><li>Secondly, break larger tasks into smaller, more manageable segments. This helps prevent overwhelm and allows you to make progress without feeling daunted by the sheer size of the task.</li><li>Lastly, prioritise and eliminate non-essential activities that consume your time but don’t contribute to your catching-up efforts.</li></ol><h3>Seeking Help and Support</h3><ol><li>Don’t hesitate to seek help and support when catching up on your studies. Reach out to your teachers, professors, or classmates for clarification on concepts or assistance with assignments.</li><li>They are there to support your learning journey and can provide valuable insights and guidance.</li><li>Additionally, consider forming study groups with peers who are also catching up. Collaborative learning can help you gain different perspectives and reinforce your understanding of the material.</li><li>Remember, asking for help is a sign of strength, not weakness, and can significantly impact your catching-up process.</li></ol><h3>Staying Motivated and Avoiding Procrastination</h3><ol><li>Staying motivated throughout the catching-up process can be challenging. However, there are strategies you can employ to maintain your motivation and avoid procrastination.</li><li>Firstly, remind yourself of the reasons why catching up is important to you. Visualize your academic goals and the sense of accomplishment you will feel once you’ve caught up and thrived.</li><li>Break your study sessions into smaller, manageable chunks and reward yourself after completing each segment.</li><li>This can be something as simple as taking a short break to indulge in a favorite activity or treating yourself to a small treat. By incorporating rewards, you create a positive association with studying and make it more enjoyable.</li></ol><h3>Tracking Your Progress and Making Adjustments</h3><ol><li>Tracking your progress is essential to ensure that you’re making steady progress towards catching up on your studies. Regularly evaluate your study schedule and goals to assess if they are realistic and attainable.</li><li>If you find that certain tasks or subjects require more time or attention than anticipated, make adjustments accordingly.</li><li>Consider keeping a study journal or using digital tools to record your progress and reflect on your learning journey.</li><li>This will not only help you stay organised but also provide a visual representation of your growth and accomplishments.</li></ol><p>Remember to prioritize self-care and maintain a healthy work-life balance. Take breaks, exercise regularly, and ensure you get enough sleep. These practices will not only support your overall well-being but also enhance your cognitive functioning and academic performance.</p><h3>Conclusion</h3><p>Catching up on your studies can seem like a daunting task, but with a step-by-step approach, effective study techniques, and a supportive mindset, you can not only catch up but also thrive in your academic journey.</p><p>With dedication and perseverance, you will not only catch up on your studies but also build a foundation for future success. So, take that first step today and embark on your catching-up journey with confidence.</p><p>Hope you found this helpful! Checkout my Instagram for more tips- <a href="https://www.instagram.com/thestudypie/">https://www.instagram.com/thestudypie/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c30c55e4fc0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is middleware in Express.js?]]></title>
            <link>https://medium.com/@shanyavermaofficial/what-is-middleware-in-express-js-b1ecd9ca87b7?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1ecd9ca87b7</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 11:28:51 GMT</pubDate>
            <atom:updated>2023-08-28T11:28:51.453Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2jLEOZV4OjV2wCDYMYCupQ.png" /></figure><p>Express.js is all about middleware.</p><p>Middleware refers to functions that are used to process and manipulate incoming requests and outgoing responses. Middleware functions are executed in the order they are defined and play a crucial role in enhancing the functionality of your Express application by adding features, handling tasks, and modifying data before the request reaches its final destination (route handler) or before the response is sent back to the client.</p><p>In the end, middleware means that an incoming request is automatically funnelled through a bunch of functions by Express.js</p><p>Middleware functions have access to the request object (req), the response object (res), and the next function.</p><ol><li>The req object contains information about the incoming request, such as headers, parameters, and the request body.</li><li>The res object is used to build and send the response to the client.</li><li>The next function is a callback that tells Express to move on to the next middleware function in the chain.</li></ol><p>Let’s consider an example:</p><pre>const express = require(&#39;express&#39;);<br>const app = express();<br><br>app.use((req, res, next)=&gt;{<br>   console.log(&quot;In the middleware&quot;);<br>   next();<br>}); <br><br>app.use((req, res, next)=&gt;{<br>   console.log(&quot;In the second middleware&quot;);<br>   res.send(&#39;&lt;h1&gt;Hello from Express&lt;/h1&gt;&#39;); //send a response<br>});<br><br>app.listen(3000, () =&gt; {<br>    console.log(&#39;Server is listening on port 3000&#39;);<br>});</pre><p>use() allows us to add a new middleware function. Accepts an array of request handlers. The function you pass to it, will be executed for every incoming request.</p><p>Express offers built-in middleware as well as the ability to create custom middleware to suit your application’s needs. Hope you found this helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1ecd9ca87b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a Node server]]></title>
            <link>https://medium.com/@shanyavermaofficial/how-to-create-a-node-server-7f14197e712a?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f14197e712a</guid>
            <category><![CDATA[nodejs-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[node]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Thu, 17 Aug 2023 09:40:18 GMT</pubDate>
            <atom:updated>2023-08-17T09:49:36.377Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5f-ZRsn5GYwtnDK1wtPcsg.png" /></figure><p>You all must be knowing that you can use Node.js for creating web servers and writing server side logic for a full stack application.</p><p>In this blog we will be talking about how to create a Node server.</p><p>We will be first importing the http core module which is used to launch a server and also for sending requests in our app.js:</p><pre>const http = require(&#39;http&#39;);</pre><p>Now we can use the functionalities offered by the http core module, here, the createServer() method:</p><pre>const http = require(&#39;http&#39;);<br><br>const server = http.createServer((req, res) =&gt; {<br>  console.log(req);<br>});<br><br>server.listen(1800);</pre><h4><strong>createServer() method:</strong></h4><ol><li>As the name suggests, it is crucial to create a server</li><li>Syntax:</li></ol><pre>function createServer(requestListener?: (request: IncomingMessage, <br>response: ServerResponse) =&gt; void): Server </pre><p>3. A requestListener is a function that will execute for every incoming request and it receives two arguments-</p><p>a. request- Node.js automatically gives us some object that represents the incoming request and allows us to read data from that request</p><p>b. response- It also gives us an object response which we can use to return a response to whoever sent that request.</p><p>4. The createServer method returns a Server</p><h4>listen() method:</h4><ol><li>It starts a process where Node.js will not immediately exit our script but where it will instead keep this running to listen for incoming requests.</li><li>It takes a couple of optional arguments:</li><li>First one is the port on which you want to listen</li><li>Second is hostname- by default this will be the name of the machine this is ruuning on. As a result, for your local machine, this is localhost by default</li></ol><p>Now, if you run the file by — node app.js and go to <a href="http://localhost:1800/">http://localhost:1800/</a>, you will be able to see the request object in your terminal.</p><p>And this is how you can very easily create your own server!</p><p>Now, if you want to unregister from your event listener, you can do that by process.exit(), that is:</p><pre>const http = require(&#39;http&#39;);<br><br>const server = http.createServer((req, res) =&gt; {<br>  console.log(req);<br>  process.exit();<br>});<br><br>server.listen(1800);</pre><p>This will exit the event loop.</p><p>Typically you don’t want to quit your server because then people won’t be able to reach your webpage anymore</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f14197e712a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Callback Hell and how to avoid it?]]></title>
            <link>https://medium.com/@shanyavermaofficial/what-is-callback-hell-and-how-to-avoid-it-6e9a7c2528a1?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e9a7c2528a1</guid>
            <category><![CDATA[callback-function]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[callback-hell]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 09:48:06 GMT</pubDate>
            <atom:updated>2023-08-15T09:48:06.306Z</atom:updated>
            <content:encoded><![CDATA[<p>A lot of times, developers have to rely on callbacks for working with asynchronous JS code. As a result, they might face something known as a Callback Hell and it results in your code looking something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*j5w2KYUqfLKfoh7btERTfA.png" /></figure><h3><strong>What is a Callback?</strong></h3><p>In JavaScript, asynchronous operations are commonly used for tasks that take some time to complete, such as reading files, making network requests, or interacting with databases.</p><p>To handle these asynchronous operations, callbacks are often used. A callback is a function that is passed as an argument to another function and is executed once a certain operation is completed.</p><h3><strong>What is Callback Hell?</strong></h3><p>Callback hell, also known as the “Pyramid of Doom,” is a term used in the context of asynchronous programming in JavaScript.</p><p>It refers to a situation where you have multiple nested callbacks within callbacks, creating a deeply indented and hard-to-follow code structure. This can make the code difficult to read, understand, and maintain, leading to a decrease in code quality and developer productivity.</p><p>As we saw, your code can end up looking like this:</p><pre>asyncOperation1(function(result1) {<br>    asyncOperation2(result1, function(result2) {<br>        asyncOperation3(result2, function(result3) {<br>            asyncOperation4(result3, function(result4) {<br>                asyncOperation3(result4, function(result5) {<br>                    // ... more nested callbacks<br>                });<br>            });<br>        });<br>    });<br>});</pre><h3><strong>How to avoid it?</strong></h3><p>To address callback hell, developers have adopted various techniques and patterns. One of the most popular approaches is to use Promises or async/await, which were introduced to JavaScript to make asynchronous code more manageable and readable. With Promises and async/await, you can write asynchronous code in a more linear and synchronous-like fashion, without the need for deeply nested callbacks.</p><p>Using Promises, the code could be rewritten as follows:</p><p>(A Promise is an object representing the eventual completion or failure of an asynchronous operation. You attach callbacks to a Promise object, instead of passing callbacks into a function)</p><pre>asyncOperation1()<br>    .then(result1 =&gt; asyncOperation2(result1))<br>    .then(result2 =&gt; asyncOperation3(result2))<br>    .then(result3 =&gt; {<br>        // ... more code here<br>    })<br>    .catch(error =&gt; {<br>        // Handle errors here<br>    });</pre><p>And using async/await:</p><pre>try {<br>    const result1 = await asyncOperation1();<br>    const result2 = await asyncOperation2(result1);<br>    const result3 = await asyncOperation3(result2);<br>    // ... more code here<br>} catch (error) {<br>    // Handle errors here<br>}</pre><p>Both Promises and async/await help mitigate the callback hell problem by providing a more structured and readable way to handle asynchronous operations and their outcomes.</p><p>Hope you found this helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e9a7c2528a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[After School Study Schedules]]></title>
            <link>https://medium.com/@shanyavermaofficial/after-school-study-schedules-59c12fe3896b?source=rss-af241975cd3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/59c12fe3896b</guid>
            <category><![CDATA[schedule]]></category>
            <category><![CDATA[productive]]></category>
            <category><![CDATA[study-tips]]></category>
            <category><![CDATA[schools]]></category>
            <dc:creator><![CDATA[Shanya Verma]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 17:38:05 GMT</pubDate>
            <atom:updated>2023-08-14T17:38:05.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="school" src="https://cdn-images-1.medium.com/max/1000/0*MExgSFvX5To35DsY" /></figure><p>One of the things that will help you stay motivated is making a study schedule for yourself. Sharing some study schedules for inspiration:</p><h3><strong>6 hours of studying</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4dZN9ywWQ996tVtw-BC_oA.png" /></figure><h3><strong>5 hours of studying</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kyb1Yla1plsb0u5YBC1ukQ.png" /></figure><h3><strong>5 hours of studying II</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQheHxKGB2hBg6gmeRCGZQ.png" /></figure><h3><strong>4.5 hours of studying</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQkB2dSyKJnZJVVKjJ_MNw.png" /></figure><h3><strong>4 hours of studying</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxaBMl0V0-YP72H1BLxORA.png" /></figure><h3><strong>3.5 hours of studying</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*defKcR0Qn7ztkjUs1V2JZw.png" /></figure><h3><strong>3 hours of studying</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAmEbPVvZ5pZtY7Rb9fy3w.png" /></figure><h3>What is Pomodoro technique?</h3><ul><li>Pomodoro technique is when you study for 30–35 minutes (according to your focus span) and then take a 5–10 min break.</li><li>Don’t watch Netflix or TV during this break else it’ll turn to a 30–40 min break</li><li>Please note that everyone one’s focus span is different. For example, for me it’s around 1.5 hours, that is, I start to lose my focus after this time and this is my sign to take a quick 15–20 minutes to freshen up!</li></ul><h3>A reminder for you:</h3><ul><li>It’s okay to not follow a schedule every single day and try new things.</li><li>If you prefer making schedules, there might be days when you won’t be able to follow it and that’s completely okay. Don’t be so hard on yourself</li></ul><h3>A small note:</h3><p>You must have noticed that I have included working out in all the schedules.</p><p>We, as students, always neglect taking care of our physical health. This is your reminder to start moving your body. It has more benefits than you can think!</p><p>Lastly, these schedules are just for reference. You can make changes to adapt them to your own personal needs. Hope you find these helpful! Head on to my Instagram for more schedules and other tips-&gt; <a href="https://www.instagram.com/thestudypie/">https://www.instagram.com/thestudypie/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59c12fe3896b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>