<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community:  Theodora Cristea</title>
    <description>The latest articles on DEV Community by  Theodora Cristea (@cristea_theodora).</description>
    <link>https://dev.to/cristea_theodora</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3264351%2F2030f39b-20fb-4bf5-bb85-7055b8dbe034.jpg</url>
      <title>DEV Community:  Theodora Cristea</title>
      <link>https://dev.to/cristea_theodora</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cristea_theodora"/>
    <language>en</language>
    <item>
      <title>Rappelo was launched: how we help solopreneurs and small businesses❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Mon, 23 Feb 2026 16:36:25 +0000</pubDate>
      <link>https://dev.to/rappelo/rappelo-was-launched-how-we-help-solopreneurs-and-small-businesses-3aml</link>
      <guid>https://dev.to/rappelo/rappelo-was-launched-how-we-help-solopreneurs-and-small-businesses-3aml</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;Hey everyone!🥰&lt;br&gt;
Lately, I’ve been working closely with my co-founder, &lt;a class="mentioned-user" href="https://dev.to/alexandru-ene-dev"&gt;@alexandru-ene-dev&lt;/a&gt;, on a project born from a simple observation: for any &lt;strong&gt;small business&lt;/strong&gt; or &lt;strong&gt;solo-operator&lt;/strong&gt;, the inbox can easily become the place where opportunities die quietly. Not because they don’t care. Not because they don’t want to reply. But because they’re busy doing the &lt;strong&gt;actual work&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://rappelo.com" rel="noopener noreferrer"&gt;Rappelo is Live!&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgaojvbxm5ppoo73qy3ll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgaojvbxm5ppoo73qy3ll.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Why did we build Rappelo❓
&lt;/h1&gt;

&lt;p&gt;When you're responsible for running a business, you inevitably take on multiple roles to keep everything moving. Even during moments of deep focus or important meetings, you want to stay in control and be &lt;strong&gt;the first to respond to a client&lt;/strong&gt;. However, operational reality often gets in the way, the intention to reply "right after I finish this task" frequently turns into an &lt;strong&gt;unintentional&lt;/strong&gt; oversight.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Real Problem
&lt;/h1&gt;

&lt;p&gt;We’ve noticed that most businesses reply &lt;strong&gt;hours&lt;/strong&gt; or even &lt;strong&gt;days later&lt;/strong&gt;. Not because they don't care, but because they are busy doing the actual work. Customers tend to choose the &lt;strong&gt;first business&lt;/strong&gt; that responds. They go with whoever gives them attention while their interest is at its peak. If you let more than 30 minutes pass, the chances of closing that deal decrease considerably.&lt;/p&gt;

&lt;p&gt;Every minute of waiting reduces the probability of a sale or a booking. We didn’t build Rappelo to "hunt" people, but because we want to be that &lt;strong&gt;first hand&lt;/strong&gt; reached out. We want to help you to be the most helpful and prompt partner for your customers, showing them that you value their time from the very first second.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqzmnymrfsrg9ld9rd3m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqzmnymrfsrg9ld9rd3m.png" alt=" " width="800" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  More than just a notification
&lt;/h1&gt;

&lt;p&gt;Email wasn't built for speed; it was built for asynchronous communication &lt;em&gt;whenever you have time&lt;/em&gt;, but Rappelo is built for &lt;strong&gt;now.&lt;/strong&gt; While inboxes get cluttered and CRMs become too complicated, we wanted to create a &lt;strong&gt;safety net&lt;/strong&gt; that keeps you focused without pulling you out of your workflow.&lt;/p&gt;

&lt;p&gt;Rappelo helps you &lt;strong&gt;capture the lead&lt;/strong&gt;, gives you a nudge if you forget to reply, and helps you contact potential clients without losing track of a single one. It’s a simple lead recovery tool that focuses on speed:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fast Onboarding&lt;/strong&gt;: 60 seconds onboarding&lt;br&gt;
&lt;strong&gt;Instant Alerts&lt;/strong&gt;: Know the second a lead hits your site&lt;br&gt;
&lt;strong&gt;Snooze Alerts&lt;/strong&gt;: Remind me in 10, 30 or 60 minutes&lt;br&gt;
&lt;strong&gt;Neglect Detection&lt;/strong&gt;: A daily nudge if a lead hasn't been contacted&lt;br&gt;
&lt;strong&gt;Simple Dashboard&lt;/strong&gt;: View lead status and follow-up performance analytics&lt;br&gt;
&lt;strong&gt;Zero Complexity&lt;/strong&gt;: No complex CRM features&lt;br&gt;
&lt;strong&gt;Free Trial&lt;/strong&gt;: You have 14 days free trial. No credit card required. Cancel anytime&lt;/p&gt;




&lt;h1&gt;
  
  
  Rappelo is officially &lt;a href="https://rappelo.com" rel="noopener noreferrer"&gt;live&lt;/a&gt;!
&lt;/h1&gt;

&lt;p&gt;We hit the launch button on &lt;strong&gt;Product Hunt&lt;/strong&gt;. To be honest, we aren't at the top of the leaderboard, but for us, today is about starting the conversation with our first &lt;strong&gt;50 Founding Members&lt;/strong&gt; who resonate with this problem.&lt;/p&gt;

&lt;p&gt;If you have a moment to take a look at what we've built, we would truly appreciate your support on our &lt;strong&gt;Product Hunt page&lt;/strong&gt; and beyond. An upvote or a short comment would mean a lot to us and help more people discover Rappelo. &lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thank you so much for reading and spending your valuable time with this article.❤️ We're excited to hear your thoughts, and we’d love to have you along for the ride.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://rappelo.com/" rel="noopener noreferrer"&gt;Website Rappelo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.producthunt.com/products/rappelo?launch=rappelo" rel="noopener noreferrer"&gt;Product Hunt&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/cristea-theodora-0b2437350/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>discuss</category>
      <category>development</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Developer's Safety Net - Introduction to TypeScript</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Mon, 01 Dec 2025 12:58:31 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/the-developers-safety-net-introduction-to-typescript-2jof</link>
      <guid>https://dev.to/cristea_theodora/the-developers-safety-net-introduction-to-typescript-2jof</guid>
      <description>&lt;p&gt;Hey everyone!👋&lt;br&gt;
When developers hear about TypeScript for the first time, the same doubts, questions and confusion always show up. And that's completely normal, TypeScript can &lt;strong&gt;seem complicated&lt;/strong&gt; at first. It might even feel like you're &lt;strong&gt;writing extra code&lt;/strong&gt; compared to plain JavaScript, or that your code is already &lt;strong&gt;clear enough&lt;/strong&gt; without it.&lt;/p&gt;

&lt;p&gt;But in reality, TypeScript is a &lt;strong&gt;tool&lt;/strong&gt; that helps us write &lt;strong&gt;safe&lt;/strong&gt;, &lt;strong&gt;cleaner&lt;/strong&gt;, and more &lt;strong&gt;understandable&lt;/strong&gt; code.&lt;br&gt;
Think of TypeScript like walking on a tightrope with a safety net🙃(compiler). If you make a mistake, the net(TS) &lt;strong&gt;catches you&lt;/strong&gt; instantly and tells you exactly &lt;strong&gt;where things went wrong&lt;/strong&gt;, long before the audience(your users) ever sees a problem.&lt;/p&gt;

&lt;p&gt;JavaScript on the other hand, is like walking that tightrope without a safety net, you &lt;strong&gt;move fast&lt;/strong&gt;, but even a &lt;strong&gt;tiny mistake&lt;/strong&gt;(a comma, a misspelled method, an unexpected type) can bring your whole program &lt;strong&gt;crashing down&lt;/strong&gt; at runtime. &lt;/p&gt;

&lt;p&gt;If you're already using TypeScript, your code is in &lt;strong&gt;good hands&lt;/strong&gt;👏, and hopefully this article will reinforce why adopting it was the &lt;strong&gt;right decision&lt;/strong&gt;! &lt;br&gt;
If you're not using TypeScript yet but you're thinking about &lt;strong&gt;introducing&lt;/strong&gt; it in the future, &lt;strong&gt;I hope&lt;/strong&gt; this article helps you make a confident choice!&lt;/p&gt;




&lt;p&gt;In this article, we will talk about: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What TypeScript actually is?&lt;/li&gt;
&lt;li&gt;TypeScript or JavaScript!?&lt;/li&gt;
&lt;li&gt;Should you learn TypeScript or JavaScript first?&lt;/li&gt;
&lt;li&gt;Why TypeScript is worth using?&lt;/li&gt;
&lt;li&gt;What to watch out for when learning TypeScript?&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. What TypeScript actually is?
&lt;/h2&gt;

&lt;p&gt;TypeScript is a &lt;strong&gt;superset&lt;/strong&gt; of JavaScript, meaning it's an &lt;strong&gt;extended&lt;/strong&gt; version of JavaScript. This means that any &lt;strong&gt;valid&lt;/strong&gt; &lt;code&gt;JavaScript&lt;/code&gt; code is &lt;strong&gt;also&lt;/strong&gt; valid &lt;code&gt;TypeScript&lt;/code&gt; code, so &lt;strong&gt;it's not&lt;/strong&gt; an entirely new language!&lt;/p&gt;

&lt;p&gt;In other words, JavaScript is a flexible &lt;strong&gt;language&lt;/strong&gt; but lacks strict checks, while TypeScript is still JavaScript, just enhanced with a static &lt;strong&gt;type system&lt;/strong&gt;. This helps us avoid mistakes &lt;strong&gt;before&lt;/strong&gt; we even run the code by telling the program exactly what kind of data we expect (number, string, object...).&lt;/p&gt;

&lt;p&gt;It's like installing an alarm system in our code that warns us ahead of time: &lt;em&gt;Careful something doesn't match here!⚠️&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6ygir6n1cxwxguzim6w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6ygir6n1cxwxguzim6w.gif" alt=" " width="220" height="165"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  2. TypeScript or JavaScript!?
&lt;/h2&gt;

&lt;p&gt;We often fall into the trap of comparing TypeScript with JavaScript, as if the two were competitors fighting for the same spot. But this is actually the wrong way to look at it. TypeScript &lt;strong&gt;shouldn't&lt;/strong&gt; be seen as something opposite to JavaScript, it should be seen as a &lt;strong&gt;tool&lt;/strong&gt; for JavaScript, something that works alongside it, enhances it, and never replaces it.&lt;/p&gt;

&lt;p&gt;The reason we tend to compare the two is because we assume TypeScript is another language trying to do what JavaScript already does. But TypeScript doesn't replace JavaScript, it builds on top of it.&lt;/p&gt;

&lt;p&gt;Think of JavaScript as the engine of a car, powerful, capable, and essential. TypeScript is not a different engine. It’s more like adding navigation, sensors, and safety features. You’re still driving the same car, but now it guides you, warns you, and protects you from mistakes before they happen.&lt;/p&gt;

&lt;p&gt;So the right mindset isn't JavaScript &lt;em&gt;OR&lt;/em&gt; TypeScript, but JavaScript &lt;strong&gt;WITH&lt;/strong&gt; TypeScript! JavaScript runs the program. TypeScript helps us write it better.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlbsla2gmjzx6kmh8r41.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlbsla2gmjzx6kmh8r41.jpg" alt=" " width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you start using TypeScript, your perspective shifts. You stop seeing rivalry between them. It becomes clear: &lt;strong&gt;collaboration&lt;/strong&gt;, not competition. An &lt;strong&gt;upgrade&lt;/strong&gt;, not a replacement!&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Should you learn TypeScript or JavaScript first!?
&lt;/h2&gt;

&lt;p&gt;As we've discussed, it should be pretty clear by now that you should learn &lt;strong&gt;JavaScript first&lt;/strong&gt;. Why❓Because if you don't understand &lt;strong&gt;at least&lt;/strong&gt; the basic concepts of JS (variables, functions, objects, async, the DOM, and so on), TypeScript will feel &lt;strong&gt;confusing&lt;/strong&gt; and &lt;strong&gt;difficult&lt;/strong&gt; to use. Without a solid foundation in JavaScript, you have nothing to apply TypeScript's safety features to. &lt;/p&gt;




&lt;h2&gt;
  
  
  4. Why TypeScript is worth using?
&lt;/h2&gt;

&lt;p&gt;Large companies and development teams use TypeScript to solve real problems and save valuable time. Some of the biggest benefits of TypeScript include:&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Early error detection&lt;/strong&gt;: more than 80% of common JavaScript errors are caught by the TypeScript compiler before we even run the code. This means less time spent debugging and more time building new features.&lt;br&gt;
→ &lt;strong&gt;Increased productivity (IntelliSense)&lt;/strong&gt;: TypeScript gives us a far better coding experience in our editor (especially in VS Code).&lt;br&gt;
→ &lt;strong&gt;Smart autocomplete&lt;/strong&gt;: it knows exactly what properties an object has and gives precise suggestions.&lt;br&gt;
→ &lt;strong&gt;Easy navigation&lt;/strong&gt;: you can click on a function and instantly see its structure and definitions.&lt;br&gt;
→ &lt;strong&gt;Easier teamwork&lt;/strong&gt;:&lt;br&gt;
Everyone on the team can clearly see what shape the data has, what parameters are required, and what can or cannot be null. This drastically reduces misunderstandings and mistakes.&lt;br&gt;
→ &lt;strong&gt;Easier to maintain&lt;/strong&gt;: TypeScript helps keep order and consistency in a codebase that has grown significantly, making scaling and refactoring far more manageable.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. What to watch out for when learning TypeScript?
&lt;/h2&gt;

&lt;p&gt;TypeScript is an amazing tool, but it also comes with some &lt;strong&gt;responsibilities&lt;/strong&gt; that we don't really have in plain JavaScript. When learning it, we need to be &lt;strong&gt;mindful&lt;/strong&gt; about what our code is actually &lt;strong&gt;doing&lt;/strong&gt; and what &lt;strong&gt;types&lt;/strong&gt; of data you &lt;strong&gt;expect&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;We have to think about types&lt;/strong&gt;:&lt;br&gt;
In JavaScript, we can often get away with writing code without worrying too much about the type of a variable. In TypeScript, we are expected to be &lt;strong&gt;explicit&lt;/strong&gt; about what our variables, functions, and objects are supposed to hold.&lt;br&gt;
For example, a variable is a &lt;code&gt;string&lt;/code&gt; or a &lt;code&gt;number&lt;/code&gt;? TypeScript wants us to define it. This is great for &lt;strong&gt;catching mistakes&lt;/strong&gt;, but it also means we need to &lt;strong&gt;understand&lt;/strong&gt; our own code clearly.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;TypeScript won't magically fix bad logic&lt;/strong&gt;:&lt;br&gt;
Just because we're using TypeScript doesn't mean our code is automatically correct. TS can warn you about type mismatches, but it can't know the intended behavior. We still need to understand what our functions are supposed to do and how our data flows.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Be careful with &lt;code&gt;any&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
The &lt;code&gt;any&lt;/code&gt; type is like turning off TypeScript's safety net. It's useful for experimenting, but relying on it too much defeats the purpose of TypeScript. Learning TS means learning to avoid &lt;code&gt;any&lt;/code&gt; whenever possible and embrace proper types.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Errors are our friends&lt;/strong&gt;:&lt;br&gt;
When the compiler complains, don't ignore it. TypeScript is designed to catch problems early, &lt;strong&gt;not annoy us&lt;/strong&gt;. Paying attention to its warnings will save us hours of debugging later.&lt;/p&gt;

&lt;p&gt;Learning TypeScript &lt;strong&gt;isn't&lt;/strong&gt; just about syntax. It's about &lt;strong&gt;understanding&lt;/strong&gt; our code deeply and being &lt;strong&gt;explicit&lt;/strong&gt; about the shape of our data. The more we practice thinking in terms of &lt;strong&gt;types&lt;/strong&gt;, the safer and more maintainable our code becomes!&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion❤️
&lt;/h2&gt;

&lt;p&gt;If you're already using TypeScript, I can safely say you're a &lt;strong&gt;professional bug fixer&lt;/strong&gt;!😂🤗&lt;br&gt;
And if you're thinking about trying TypeScript, especially if you're still &lt;strong&gt;wrestling with bugs&lt;/strong&gt; hiding across your application, I hope this article gave you the &lt;strong&gt;confidence&lt;/strong&gt; to take your &lt;strong&gt;first steps&lt;/strong&gt; into it. Every developer &lt;strong&gt;grows&lt;/strong&gt; by learning new tools, and TypeScript is definitely one that will make you &lt;strong&gt;stronger&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you're just getting started, take it &lt;strong&gt;one step&lt;/strong&gt; at a time, and remember, mastering TypeScript is a &lt;strong&gt;long-term investment&lt;/strong&gt; that truly pays off.&lt;br&gt;
Keep &lt;strong&gt;experimenting&lt;/strong&gt;, keep &lt;strong&gt;learning&lt;/strong&gt;, and allow yourself to make &lt;strong&gt;mistakes&lt;/strong&gt;, TypeScript is watching you! 😂🙃&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for your time&lt;/strong&gt;, I’ll be back soon with more TypeScript articles. If you enjoyed this post, learned something new, or if it brought back a smile thinking about your first doubts with TypeScript, don't forget to like the post, leave a comment, and to follow me!&lt;br&gt;
I would really appreciate it! &lt;strong&gt;Happy reading&lt;/strong&gt;!🥰&lt;/p&gt;




</description>
      <category>typescript</category>
      <category>development</category>
      <category>backend</category>
      <category>beginners</category>
    </item>
    <item>
      <title>From localStorage to Database: Understanding the MongoDB Structure❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Wed, 19 Nov 2025 05:55:18 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/from-localstorage-to-database-understanding-the-mongodb-structure-1a21</link>
      <guid>https://dev.to/cristea_theodora/from-localstorage-to-database-understanding-the-mongodb-structure-1a21</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;Hey everyone!🤗 If you are a developer who is &lt;strong&gt;just starting&lt;/strong&gt; to work with databases, or perhaps you already know the basics and are looking for a recap or a &lt;strong&gt;more in-deph&lt;/strong&gt; understanding, I hope this article will help you.&lt;br&gt;
When I learn something new, I like to dig deeper and  understand the &lt;strong&gt;underlying logic&lt;/strong&gt; to ensure everything is clear. That's why I have structured this article starting from the &lt;code&gt;NoSQL&lt;/code&gt; fundamentals all the way to the internal data storage mechanisms, concentrating on the &lt;strong&gt;why&lt;/strong&gt; behind the database. So, I wish you &lt;strong&gt;happy reading&lt;/strong&gt;!🥰&lt;/p&gt;



&lt;p&gt;In this article, we will study:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=""&gt;Where we Started: The SQL World&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;The NoSQL story: Not Only SQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;From localStorage to Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;Basic CRUD Operations: Create, Read, Update, Delete&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;h1&gt;
  
  
  1. Where we Started: The SQL World
&lt;/h1&gt;

&lt;p&gt;When we work with Relational Database like &lt;code&gt;MySQL&lt;/code&gt; or &lt;code&gt;PostgreSQL&lt;/code&gt;, our data lines up neatly in those perfectly organized tables. We have to make sure &lt;strong&gt;every single row&lt;/strong&gt; follows a &lt;strong&gt;rigid&lt;/strong&gt; column blueprint, decided right from the start. If we ever need to &lt;strong&gt;switch up&lt;/strong&gt; that structure, we basically &lt;em&gt;hit the brakes&lt;/em&gt;, tackle complex changes, and cross our fingers that all the existing data &lt;strong&gt;still fits&lt;/strong&gt;. &lt;br&gt;
We got consistency and logic out of this, sure, but as our &lt;strong&gt;apps kept scaling&lt;/strong&gt;, that stiffnes became a real &lt;strong&gt;bottleneck&lt;/strong&gt; for moving fast.&lt;/p&gt;


&lt;h1&gt;
  
  
  2. The NoSQL story: Not Only SQL
&lt;/h1&gt;

&lt;p&gt;When it comes to &lt;code&gt;NoSQL&lt;/code&gt; databases, you might have heard that it means &lt;em&gt;No SQL&lt;/em&gt;, but let's clear things up: it's not a total war against &lt;code&gt;SQL&lt;/code&gt;! The correct and modern interpretation is &lt;em&gt;Not Only SQL&lt;/em&gt;❗&lt;/p&gt;
&lt;h4&gt;
  
  
  Why 'Not Only SQL'❓
&lt;/h4&gt;

&lt;p&gt;Because we relize that &lt;code&gt;SQL&lt;/code&gt; is a fantastic certain tasks (where strict relationship and consistency are &lt;strong&gt;vital&lt;/strong&gt;), today's modern applications (social networks, gaming, websites) demand &lt;strong&gt;speed&lt;/strong&gt; and &lt;strong&gt;flexibility&lt;/strong&gt;. &lt;code&gt;NoSQL&lt;/code&gt; is a supplement, an alternative that allows us to choose the right tool for the right job. We &lt;strong&gt;aren't giving up&lt;/strong&gt; on &lt;code&gt;SQL&lt;/code&gt;, we're just &lt;strong&gt;adding&lt;/strong&gt; more powerful to our toolkit.&lt;/p&gt;


&lt;h1&gt;
  
  
  3. From localStorage to Database
&lt;/h1&gt;

&lt;p&gt;Among the many types of &lt;code&gt;NoSQL&lt;/code&gt; databases, MongoDB falls in to the &lt;em&gt;Document-Oryented&lt;/em&gt; category.&lt;/p&gt;

&lt;p&gt;Imagne no longer storing data across separate rows and columns. Instead, you store a &lt;strong&gt;complete record&lt;/strong&gt;, for example, a user profile with all their addresses, orders, and preferences, in a single package called a &lt;strong&gt;Document&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Document:
&lt;/h3&gt;

&lt;p&gt;→ The Document is the basic &lt;strong&gt;building block&lt;/strong&gt;. It looks exactly like a &lt;code&gt;JSON&lt;/code&gt; (JavaScript Object Notation) object, but, technically speacking, MongoDB uses &lt;code&gt;BSON&lt;/code&gt; (Binary &lt;code&gt;JSON&lt;/code&gt;). Why BSON❓ Because it's a &lt;strong&gt;faster binary format&lt;/strong&gt; that also includes &lt;strong&gt;data&lt;/strong&gt; types that simple &lt;code&gt;JSON&lt;/code&gt; dosen't have (like date/ time values).&lt;/p&gt;

&lt;p&gt;→ All these Documents (which, note, &lt;strong&gt;do not have to look identical&lt;/strong&gt;) are grouped into a &lt;strong&gt;Collection&lt;/strong&gt;, a kind of &lt;em&gt;folder&lt;/em&gt; that replaces the old &lt;em&gt;tables.&lt;/em&gt; To get an idea, we can think of documents &lt;strong&gt;as the value&lt;/strong&gt; stored in &lt;code&gt;localStorage&lt;/code&gt;, but they are much more powerful than a simple string value in &lt;code&gt;localStorage&lt;/code&gt;❗&lt;/p&gt;

&lt;p&gt;→ The Document is the &lt;strong&gt;smallest&lt;/strong&gt; and &lt;strong&gt;most important&lt;/strong&gt; unit of data in MongoDB, being the complete package of information that offers tremendous flexibility by &lt;strong&gt;allowing&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;→ Storing &lt;strong&gt;nested objects&lt;/strong&gt;,&lt;br&gt;
→ Storing &lt;strong&gt;lists&lt;/strong&gt;,&lt;br&gt;
→ Direct storage of &lt;strong&gt;complex data types&lt;/strong&gt; (such as Date/Time).&lt;/p&gt;

&lt;p&gt;Here we have a &lt;code&gt;Document&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="p"&gt;{&lt;/span&gt;    &lt;span class="c1"&gt;// unique ID &lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;_id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ObjectId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;61a5c6f0e8f0b7c4d5a9b8c7&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
     &lt;span class="c1"&gt;// complex data type: Date/Time&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;order_date&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ISODate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2025-11-18T10:00:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;status&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Shipped&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// nested object&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shipping_address&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;street&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;10 Example Blvd&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;city&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;London&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zip_code&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SW1A 0AA&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="c1"&gt;// list (Array)&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;items&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;product_name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Laptop Pro&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;quantity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1200.00&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;product_name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mouse Wireless&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;quantity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;price&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;25.50&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  Colection:
&lt;/h3&gt;

&lt;p&gt;→ If a Document is the equivalent of an individual record (like a complex &lt;strong&gt;value stored&lt;/strong&gt; in &lt;code&gt;localStorage&lt;/code&gt; or a &lt;strong&gt;row&lt;/strong&gt; in a &lt;code&gt;SQL&lt;/code&gt; table), the Collection in MongoDB is the &lt;em&gt;folder&lt;/em&gt; that holds all those records together.&lt;/p&gt;

&lt;p&gt;→The &lt;code&gt;Collection&lt;/code&gt; is the conceptual &lt;strong&gt;equivalent of a Table&lt;/strong&gt; in a relational (&lt;code&gt;SQL&lt;/code&gt;) database. Unlike a &lt;code&gt;SQL&lt;/code&gt; table, where &lt;strong&gt;all rows&lt;/strong&gt; must adhere to the &lt;strong&gt;same structure&lt;/strong&gt; (the same columns), &lt;code&gt;Documents&lt;/code&gt; within a MongoDB &lt;code&gt;Collection&lt;/code&gt; can have different structures (dynamic schema)❗&lt;/p&gt;

&lt;p&gt;→ A small example, In MongoDB, we have a Database named &lt;code&gt;school&lt;/code&gt;. This Database contains two &lt;code&gt;Collections&lt;/code&gt;: students and teachers.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frw7qquucdkmjg6wgfwep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frw7qquucdkmjg6wgfwep.png" alt=" " width="368" height="112"&gt;&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;→ 1. The &lt;code&gt;students&lt;/code&gt; Collection contains two documents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Smith&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;enrollment_date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2024-09-01T00:00:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nx"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Math&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Physics&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;English&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;// Array&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;

  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bob&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Johnson&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;enrollment_date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2023-09-01T00:00:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// nested object&lt;/span&gt;
      &lt;span class="na"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;555-1234&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bob@school.edu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;The teachers &lt;code&gt;Collection&lt;/code&gt; contains two documents:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mr.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Davis&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mathematics&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;tenure&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;555-5678&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="nx"&gt;class_count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;

  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ms.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Garcia&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;History&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;class_count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;office_hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// Nested Object&lt;/span&gt;
      &lt;span class="na"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Wednesday&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2:00 PM - 3:00 PM&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Flexibility by Nature:
&lt;/h3&gt;

&lt;p&gt;→ One user document might have a &lt;code&gt;phone&lt;/code&gt; field, while the next one &lt;strong&gt;might not&lt;/strong&gt;. This dynamic schema is the &lt;strong&gt;main reason&lt;/strong&gt; developers choose MongoDB when dealing with data that &lt;strong&gt;evolves rapidly&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;→ Therefore, MongoDB allows us &lt;strong&gt;to model data naturally&lt;/strong&gt;, like objects (documents), and these objects are managed efficiently within &lt;strong&gt;logical groups&lt;/strong&gt; called &lt;code&gt;Collections&lt;/code&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Essential Field: &lt;code&gt;_id&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;→ Every Document must have a unique field named &lt;code&gt;_id&lt;/code&gt;. This field serves as the &lt;strong&gt;Primary Key&lt;/strong&gt; for the document (just like the unique ID in a SQL row).&lt;/p&gt;

&lt;p&gt;→ If you don't specify an _id yourself when inserting data, MongoDB automatically generates one for you using a special data type called &lt;strong&gt;ObjectId&lt;/strong&gt;. This ObjectId is guaranteed &lt;strong&gt;to be unique&lt;/strong&gt; and even includes a &lt;strong&gt;timestamp&lt;/strong&gt;, giving you information about the exact moment the document &lt;strong&gt;was created&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Basic CRUD Operations:
&lt;/h1&gt;

&lt;p&gt;(Assuming the MongoDB server is installed and mongosh is ready, we can now connect to the database to see how we create collections and documents)...&lt;/p&gt;

&lt;p&gt;→ &lt;code&gt;CRUD&lt;/code&gt; operations represent the &lt;strong&gt;four basic functions&lt;/strong&gt; that underlie any persistent &lt;strong&gt;data storage&lt;/strong&gt; system. In the context of a database (such as MongoDB, although the terms apply generally), these are the methods through which we &lt;strong&gt;interact&lt;/strong&gt; with &lt;code&gt;Documents&lt;/code&gt; within a &lt;code&gt;Collection&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create: &lt;code&gt;insertOne()&lt;/code&gt;/&lt;code&gt;insertMany()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;→ The &lt;code&gt;Create&lt;/code&gt; operation adds new documents into a collection.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;insertOne(document)&lt;/code&gt;: this method is used to insert a &lt;strong&gt;single new document&lt;/strong&gt; into the collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="c1"&gt;//this will add a new document in &lt;/span&gt;
  &lt;span class="c1"&gt;//teachers collection&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;teachers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mr.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jack&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Geography&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tenure&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;555-5566&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="na"&gt;class_count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;insertMany([document1, document2, ...])&lt;/code&gt;: this method is used to insert &lt;strong&gt;multiple documents&lt;/strong&gt; into the collection with a single command. The argument is an array (list) of documents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="c1"&gt;//this will add two documents in &lt;/span&gt;
  &lt;span class="c1"&gt;//students collection&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertMany&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Lea&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Casy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
   &lt;span class="p"&gt;},&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jessy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Smith&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Read: &lt;code&gt;find()&lt;/code&gt;/&lt;code&gt;findOne()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;→ The &lt;code&gt;Read&lt;/code&gt; operation retrieves documents from the collection based on filtering criteria.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;findOne(query)&lt;/code&gt;: this method returns the &lt;strong&gt;first document&lt;/strong&gt; that matches the filtering criteria specified in the query object. It is ideal when you know you need a single document, for example, based on a unique ID. If &lt;strong&gt;no query is specified&lt;/strong&gt; (i.e., it is empty: {}), it returns the &lt;strong&gt;first document&lt;/strong&gt; found in the collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//find the first student with name 'Lea'&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Lea&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;find(query)&lt;/code&gt;: This method returns a cursor to all documents that match the specified filtering criteria. If the query object is empty ({}), it returns all documents in the collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//return all of documents from students colection&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;//find all students whose age is greater than 16&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;$gt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt; &lt;span class="p"&gt;}})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Update: updateOne()/updateMany()
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;updateOne(filter, update_operation)&lt;/code&gt;: Updates the first document that matches the given filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//finds the document with `first_name 'Jessy'` and&lt;/span&gt;
&lt;span class="c1"&gt;// sets the new grade to false.&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;updateOne&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jessy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;$set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;updateMany(filter, update_operation)&lt;/code&gt;: Updates all documents that match the given filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// It selects documents only if the field contact is absent. ($exists: false)&lt;/span&gt;
&lt;span class="c1"&gt;// and add the 'contact' object with default phone and email values.&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;updateMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. FILTER: Select documents missing the 'contact' field&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;$exists&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; 

  &lt;span class="c1"&gt;// 2. OPERATION: Use $set to add the new 'contact' object&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="na"&gt;$set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;contact.phone&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;contact.email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;default@school.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt; 
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ The Basic &lt;code&gt;$set&lt;/code&gt; Operator: This is the most common update operator. It specifies &lt;strong&gt;which fields&lt;/strong&gt; should be modified and what their new values are. It either &lt;strong&gt;replaces&lt;/strong&gt; the value of an existing field or &lt;strong&gt;adds&lt;/strong&gt; a new field if it doesn't exist.&lt;/p&gt;

&lt;p&gt;Basic Syntax: In update calls, the update operation part will often look like this: &lt;code&gt;{"$set": {"field_name": "new_value", "another_field": 123}}&lt;/code&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  4.Delete: deleteOne()/deleteMany
&lt;/h3&gt;

&lt;p&gt;→ The Delete operation removes documents from the collection.&lt;br&gt;
&lt;code&gt;deleteOne(filter)&lt;/code&gt;: deletes the &lt;strong&gt;first document&lt;/strong&gt; that matches the specified filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// delete the first student found whose first name is 'Lea'.&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deleteOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Lea&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;deleteMany(filter)&lt;/code&gt;: deletes &lt;strong&gt;all&lt;/strong&gt; documents that match the specified filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// delete all students who are currently in grade 10.&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deleteMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Caution❗If you use &lt;code&gt;deleteMany({})&lt;/code&gt; (an empty filter), you will &lt;strong&gt;delete all&lt;/strong&gt; documents in the collection. Always be careful when using delete operations.🙃&lt;/p&gt;

&lt;p&gt;Delete a colection: &lt;code&gt;db.students.drop()&lt;/code&gt;,&lt;br&gt;
Delete a database: first select the database &lt;code&gt;use school&lt;/code&gt;, then we delete it &lt;code&gt;db.dropDatabase()&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion ❤️
&lt;/h2&gt;

&lt;p&gt;While I haven't delved into the specifics of working tools, my goal for this first article was to provide a short but &lt;strong&gt;solid introduction&lt;/strong&gt; to the fundamental of MongoDB.&lt;/p&gt;

&lt;p&gt;There is a lot to explore in the world of MongoDB, but I believe these basics are essential. If you understand how data saving and retrieval work in localStorage, you can draw a &lt;strong&gt;useful analogy&lt;/strong&gt; to better grasp collections within a database.🙃 &lt;br&gt;
I will be back soon with more detailed posts on the subject, further deepening the concepts we've learned. I hope this introductory guide was helpful!&lt;/p&gt;

&lt;p&gt;If you &lt;strong&gt;enjoyed&lt;/strong&gt; this article, learned something new, or if it brought back a &lt;strong&gt;smile&lt;/strong&gt; thinking about your &lt;strong&gt;first attempts&lt;/strong&gt; in MongoDB, don't forget to like the post or leave a comment! &lt;strong&gt;Thank you so much&lt;/strong&gt; for reading and spending your valuable time with this article. I look forward to connecting with you &lt;strong&gt;in the next one&lt;/strong&gt;! Happy codding!🥰🤗&lt;/p&gt;




</description>
      <category>mongodb</category>
      <category>database</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Frontend to Backend: From Vite to Express❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Tue, 28 Oct 2025 19:19:16 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/frontend-to-backend-from-vite-to-express-2c83</link>
      <guid>https://dev.to/cristea_theodora/frontend-to-backend-from-vite-to-express-2c83</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;Hey everyone!🤗 If you're a beginner who's &lt;strong&gt;just started&lt;/strong&gt; learning the backend, or maybe you &lt;strong&gt;already know&lt;/strong&gt; the basics but want a deeper understanding of the logic &lt;strong&gt;behind servers&lt;/strong&gt;, routing requests and all those fundamentals concepts, I truly hope this article &lt;strong&gt;helps you&lt;/strong&gt; out.🥰&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;totally normal&lt;/strong&gt; to feel confused at first or not to &lt;strong&gt;grasp&lt;/strong&gt; everything immediatly, you'll figure it out eventually at the right time! Perhaps this article will &lt;strong&gt;clarify things&lt;/strong&gt;, or maybe it will just confirm what you already know! &lt;/p&gt;




&lt;p&gt;We will discuss the following concepts: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Routing: &lt;strong&gt;Frontend vs Backend&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;From &lt;strong&gt;Source&lt;/strong&gt; to &lt;strong&gt;Server&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Development vs Production: More Than Just a Command&lt;/li&gt;
&lt;li&gt;Order Matters: Handling &lt;strong&gt;Critical Paths&lt;/strong&gt; in Express&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  Routing: Frontent vs Backend
&lt;/h1&gt;

&lt;p&gt;Routing means deciding which &lt;strong&gt;piece of code&lt;/strong&gt; or &lt;strong&gt;which page&lt;/strong&gt; to return when a user accesses a specific &lt;strong&gt;URL&lt;/strong&gt; (a path, or "route"). Here lies the first &lt;strong&gt;major difference&lt;/strong&gt; between the two worlds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Frontend Routing (Vite, React Router)
&lt;/h3&gt;

&lt;p&gt;When we work with a modern frontend framework (like React with Vite or Create React App), we don't handle the routing of static files:&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Dev Server is Smart&lt;/strong&gt;: Vite's development server is designed to do one thing: help us code fast. It knows how to read our source files (those in &lt;code&gt;src/&lt;/code&gt;) and serve them automatically under the corresponding URLs.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Automatic Routing&lt;/strong&gt;: If our HTML or React code refers to &lt;code&gt;/styles/main.css&lt;/code&gt;, the Vite server &lt;strong&gt;knows&lt;/strong&gt; immediately &lt;strong&gt;where&lt;/strong&gt; to find the physical file (in its memory or the file system) and &lt;strong&gt;sends&lt;/strong&gt; it instantly to the &lt;strong&gt;browser&lt;/strong&gt;. We don't write special code for this❗&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Focus on Application Logic&lt;/strong&gt;: Using libraries like React Router, we only focus on the application logic (e.g., "If the URL is &lt;code&gt;/profile&lt;/code&gt;, display the Profile component"). This routing happens in the browser, after the JavaScript files have been loaded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsxxe9cnfokj6jz1ujcer.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsxxe9cnfokj6jz1ujcer.jpg" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Manual Routing in the Backend (Express.js)
&lt;/h3&gt;

&lt;p&gt;Express.js is just a minimal framework. It makes no assumptions and has no built-in "magic."&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Routing is Manual&lt;/strong&gt;: Once we put Express.js in charge as the main server, we must explicitly tell it what to do for every request that reaches it.&lt;/p&gt;

&lt;p&gt;Do we want the &lt;code&gt;POST&lt;/code&gt; &lt;code&gt;/api/login&lt;/code&gt; request to verify the password in the database❓ We must write &lt;code&gt;app.post('/api/login',...)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Do we want the &lt;code&gt;GET&lt;/code&gt; &lt;code&gt;/api/users&lt;/code&gt; request to return a list of users❓ We must write &lt;code&gt;app.get('/api/users', ...)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Ignorance of Static Files&lt;/strong&gt;: Without instructions, if it receives a request for &lt;code&gt;/main.css&lt;/code&gt;, Express &lt;strong&gt;doesn't know this is a static file&lt;/strong&gt;. It will look for an API route or rendering logic. Since it &lt;strong&gt;doesn't find one&lt;/strong&gt;, it implicitly returns &lt;strong&gt;404 Not Found&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When starting out, the Vite Development Server performs &lt;em&gt;silent magic&lt;/em&gt;, &lt;strong&gt;it's automatically handling all the routing&lt;/strong&gt; and serving of our static files (like CSS and images) directly &lt;strong&gt;from memory&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;However, when we introduce Express.js, &lt;strong&gt;the magic stops&lt;/strong&gt;. Express is ignorant and requires &lt;strong&gt;explicit instructions&lt;/strong&gt;. We  must &lt;strong&gt;manually&lt;/strong&gt; define our API routes (&lt;code&gt;app.get('/api/data')&lt;/code&gt;) and, most importantly, we &lt;strong&gt;must use&lt;/strong&gt; &lt;code&gt;express.static()&lt;/code&gt; to manually tell Express: "This is where you can find &lt;strong&gt;all the static files you need&lt;/strong&gt; for the web page." Without this manual step, our CSS and JavaScript files will be &lt;strong&gt;invisible to the server&lt;/strong&gt;, resulting in broken pages❗&lt;/p&gt;




&lt;h1&gt;
  
  
  From Source to Server
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Static Files in Development:
&lt;/h3&gt;

&lt;p&gt;During development, when we run &lt;code&gt;npm run dev&lt;/code&gt; in our React project:&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;No Physical Folder&lt;/strong&gt;: The Vite server reads our files (&lt;code&gt;.jsx&lt;/code&gt;, &lt;code&gt;.css&lt;/code&gt;) directly from the &lt;code&gt;src/&lt;/code&gt; directory and &lt;strong&gt;keeps them&lt;/strong&gt; in RAM (memory). It does not create a physical folder with compiled files.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Speed&lt;/strong&gt;: Any change we save is instantly transmitted to the &lt;strong&gt;browser via HMR&lt;/strong&gt; (Hot Module Reloading), making the coding experience fluid.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Not Production Ready&lt;/strong&gt;: Although fast, this mode is not &lt;strong&gt;stable&lt;/strong&gt;, &lt;strong&gt;secure&lt;/strong&gt;, or &lt;strong&gt;optimized&lt;/strong&gt; to be accessed by thousands of real users on the internet.&lt;/p&gt;




&lt;h3&gt;
  
  
  From src to dist:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;When and Why Do We Compile&lt;/strong&gt;❓ Before publishing the application (moving to Production), we must compile the code:&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Command&lt;/strong&gt;: &lt;code&gt;npm run build&lt;/code&gt;.&lt;br&gt;
→ &lt;strong&gt;Optimization&lt;/strong&gt;: This command takes all our source files (&lt;code&gt;React&lt;/code&gt;, &lt;code&gt;CSS&lt;/code&gt;, etc.), &lt;strong&gt;minifies&lt;/strong&gt; them (makes them much smaller), &lt;strong&gt;concatenates&lt;/strong&gt; them (puts them into fewer bundles), and &lt;strong&gt;optimizes&lt;/strong&gt; them for maximum loading speed.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Result &lt;code&gt;dist&lt;/code&gt;&lt;/strong&gt;: All these optimized files are put into a new, physical folder, usually called &lt;code&gt;dist&lt;/code&gt; or &lt;code&gt;build&lt;/code&gt;. This folder contains the final, &lt;strong&gt;static version of the frontend&lt;/strong&gt;, ready to be served.&lt;/p&gt;


&lt;h3&gt;
  
  
  Enter &lt;code&gt;express.static()&lt;/code&gt;:
&lt;/h3&gt;

&lt;p&gt;→ &lt;strong&gt;How Do We Serve the dist Folder&lt;/strong&gt;❓ Now that we have the &lt;strong&gt;optimized dist folder&lt;/strong&gt;, we must tell Express (the backend) that &lt;strong&gt;this is the folder&lt;/strong&gt; it needs to serve publicly:&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Solution is &lt;code&gt;express.static()&lt;/code&gt;&lt;/strong&gt;: This line of code is the instruction we give the Express server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// in production, Express serves the frontend's 'dist' folder&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;static&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;client/dist&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;→ &lt;strong&gt;What It Does&lt;/strong&gt;: Whenever an HTTP request &lt;strong&gt;reaches the server&lt;/strong&gt; and does &lt;strong&gt;not match an API route&lt;/strong&gt; we defined (e.g. doesn't start with &lt;code&gt;/api&lt;/code&gt;), Express looks in the &lt;strong&gt;dist folder&lt;/strong&gt;! If it finds a file matching the requested URL (e.g., &lt;code&gt;/style.css&lt;/code&gt;), it sends it immediately to the &lt;strong&gt;client&lt;/strong&gt; and stops the routing process❗&lt;/p&gt;




&lt;h1&gt;
  
  
  Development vs Production:
&lt;/h1&gt;

&lt;p&gt;→ If we have seen the command &lt;code&gt;npm run dev&lt;/code&gt; used in both our &lt;strong&gt;frontend&lt;/strong&gt; (React) and our &lt;strong&gt;backend&lt;/strong&gt; (Express) project directories, we might think they do the same thing. &lt;strong&gt;They don't&lt;/strong&gt;❗ This is a &lt;strong&gt;critical distinction&lt;/strong&gt;, especially when thinking about &lt;strong&gt;security&lt;/strong&gt; and &lt;strong&gt;performance&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwg25vqc02j1kk1say8s0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwg25vqc02j1kk1say8s0.jpg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;→ &lt;strong&gt;The Dual &lt;code&gt;npm run dev&lt;/code&gt;&lt;/strong&gt;: Two Servers, Two Purposes&lt;/p&gt;

&lt;p&gt;When we talk about &lt;strong&gt;Development Mode&lt;/strong&gt; (Dev) and &lt;strong&gt;Production Mode&lt;/strong&gt; (Prod), we are describing the &lt;strong&gt;state&lt;/strong&gt; and &lt;strong&gt;purpose&lt;/strong&gt; of our running code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Mode (our workbench):
&lt;/h2&gt;

&lt;p&gt;Development Mode is our &lt;strong&gt;workbench&lt;/strong&gt;, it's optimized for speed and debugging.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Purpose&lt;/strong&gt;: the sole goal is to facilitate &lt;strong&gt;rapid coding&lt;/strong&gt;, &lt;strong&gt;testing&lt;/strong&gt;, and &lt;strong&gt;debugging&lt;/strong&gt;.&lt;br&gt;
→ &lt;strong&gt;Frontend Setup&lt;/strong&gt;: the server runs the &lt;strong&gt;Vite Dev Server&lt;/strong&gt; on one port (e.g., &lt;code&gt;5173&lt;/code&gt;).&lt;br&gt;
→ &lt;strong&gt;Backend Tooling&lt;/strong&gt;: we use tools like &lt;code&gt;nodemon&lt;/code&gt; to automatically &lt;strong&gt;restart&lt;/strong&gt; the server the moment we save a change.&lt;br&gt;
→ &lt;strong&gt;Errors&lt;/strong&gt;: errors are loud and detailed (stack traces) and are printed directly to your console, helping you &lt;strong&gt;fix issues&lt;/strong&gt; instantly.&lt;br&gt;
→ &lt;strong&gt;Optimization&lt;/strong&gt;: files are served as-is, with &lt;strong&gt;minimal optimization&lt;/strong&gt;, as file size and speed aren't the primary concerns.&lt;/p&gt;


&lt;h2&gt;
  
  
  Production Mode (the live public server)
&lt;/h2&gt;

&lt;p&gt;Production Mode is the final, optimized version delivered to the public, it's built for &lt;strong&gt;stability&lt;/strong&gt; and &lt;strong&gt;security&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Purpose&lt;/strong&gt;: the goal is to deliver a stable, &lt;strong&gt;fast&lt;/strong&gt;, and &lt;strong&gt;secure&lt;/strong&gt; experience to the public.&lt;br&gt;
→ &lt;strong&gt;Frontend Setup&lt;/strong&gt;: the frontend code is first &lt;strong&gt;built&lt;/strong&gt; (compiled and minified) and then served by the single &lt;strong&gt;Express server&lt;/strong&gt; on its designated port (e.g., &lt;code&gt;3000&lt;/code&gt;).&lt;br&gt;
→ &lt;strong&gt;Backend Tooling&lt;/strong&gt;: we use &lt;strong&gt;highly&lt;/strong&gt; optimized process managers (like PM2) to keep the server running continuously and robustly.&lt;br&gt;
→ &lt;strong&gt;Errors&lt;/strong&gt;: errors are logged &lt;strong&gt;internally&lt;/strong&gt; but are never shown to the &lt;strong&gt;public user&lt;/strong&gt;, preventing security leaks❗&lt;br&gt;
→ &lt;strong&gt;Optimization&lt;/strong&gt;: files are heavily minified and aggressively cached for &lt;strong&gt;maximum performance&lt;/strong&gt; and &lt;strong&gt;faster loading&lt;/strong&gt; times for all users.&lt;/p&gt;


&lt;h2&gt;
  
  
  Security Risks:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why we don't run development mode in production&lt;/strong&gt;❓&lt;br&gt;
Running your Express server in Development Mode on a live, public server is a &lt;strong&gt;major security flaw&lt;/strong&gt; and is &lt;strong&gt;strongly discouraged&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Security Leaks&lt;/strong&gt;: Development errors often include &lt;strong&gt;sensitive data&lt;/strong&gt;, such as file paths on your server, &lt;strong&gt;environment variables&lt;/strong&gt;, or even &lt;strong&gt;glimpses&lt;/strong&gt; into your database structure. Revealing this information to an attacker is a &lt;strong&gt;severe vulnerability&lt;/strong&gt;❗&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Performance&lt;/strong&gt;: Dev mode is built for &lt;strong&gt;convenience&lt;/strong&gt;, not speed. You will experience slow &lt;strong&gt;response times&lt;/strong&gt;, poor &lt;strong&gt;resource&lt;/strong&gt; management, and limited &lt;strong&gt;scalability&lt;/strong&gt; under real user load.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Stability&lt;/strong&gt;: Tools like &lt;code&gt;nodemon&lt;/code&gt; are meant to &lt;strong&gt;restart&lt;/strong&gt; your code whenever you save a change. This behavior is unpredictable and &lt;strong&gt;highly unstable&lt;/strong&gt; for a public-facing application that needs to run 24/7❗&lt;/p&gt;


&lt;h1&gt;
  
  
  Order Matters: Handling Critical Paths in Express
&lt;/h1&gt;

&lt;p&gt;Now, let's look at the crucial process of &lt;strong&gt;setting up&lt;/strong&gt; our routes and &lt;strong&gt;middleware&lt;/strong&gt; in the correct order to ensure Express handles all requests correctly.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Role of Middleware: app.use()
&lt;/h3&gt;

&lt;p&gt;In Express, a Middleware is simply a function that executes during the &lt;strong&gt;request-response&lt;/strong&gt; cycle. It has access to the &lt;strong&gt;request&lt;/strong&gt; object &lt;code&gt;req&lt;/code&gt;, the &lt;strong&gt;response&lt;/strong&gt; object &lt;code&gt;res&lt;/code&gt;, and the &lt;strong&gt;next&lt;/strong&gt; function &lt;code&gt;next&lt;/code&gt; in the cycle.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;&lt;code&gt;app.use(middleware)&lt;/code&gt;&lt;/strong&gt;: This method is primarily used to register middleware. It executes the provided function for ALL &lt;code&gt;HTTP&lt;/code&gt; methods (&lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, etc.) and for ALL &lt;strong&gt;paths&lt;/strong&gt; (unless we specify a path prefix).&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Golden Rule&lt;/strong&gt;: Middleware executes in the &lt;strong&gt;exact order&lt;/strong&gt; they are defined in our code. Once a middleware sends a &lt;strong&gt;response&lt;/strong&gt; (e.g., &lt;code&gt;res.send('Hello')&lt;/code&gt;), the cycle stops, and no subsequent &lt;strong&gt;middleware&lt;/strong&gt; or &lt;strong&gt;route&lt;/strong&gt; handlers are executed❗&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Order of Flow&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;app.use(cors)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;app.use(express.json)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;app.use('/api', apiRouter)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app.use(express.static(dist_path))&lt;/code&gt; &amp;lt;- This is the critical separation point❗&lt;/li&gt;
&lt;li&gt;... other routes ...&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;
  
  
  The React Router Trap:
&lt;/h3&gt;

&lt;p&gt;Why We Need &lt;code&gt;app.get('*')&lt;/code&gt;❓This is the final &lt;strong&gt;piece&lt;/strong&gt; of the puzzle that links our &lt;strong&gt;backend&lt;/strong&gt; logic to our &lt;strong&gt;frontend&lt;/strong&gt; application.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Purpose&lt;/strong&gt;: the &lt;code&gt;app.get('*')&lt;/code&gt; route is the &lt;strong&gt;Catch-All&lt;/strong&gt; Handler. It uses the wildcard &lt;code&gt;*&lt;/code&gt; to match &lt;strong&gt;any &lt;code&gt;GET&lt;/code&gt; request&lt;/strong&gt; that &lt;strong&gt;hasn't&lt;/strong&gt; been handled by any middleware or route defined before it.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;The Scenario&lt;/strong&gt;: when a user types a direct link like &lt;code&gt;mysite.com/profile&lt;/code&gt; into their browser, the server sees a request for &lt;code&gt;/profile&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Express &lt;strong&gt;checks&lt;/strong&gt; the &lt;code&gt;API&lt;/code&gt; routes (e.g., &lt;code&gt;/api&lt;/code&gt;). No match❗&lt;/li&gt;
&lt;li&gt;Express &lt;strong&gt;checks&lt;/strong&gt; &lt;code&gt;express.static()&lt;/code&gt; for a file named profile. No match.❗&lt;/li&gt;
&lt;li&gt;The request &lt;strong&gt;falls&lt;/strong&gt; to &lt;code&gt;app.get('*')&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;→ &lt;strong&gt;The Solution&lt;/strong&gt;: we tell Express to simply serve the main application file (&lt;code&gt;index.html&lt;/code&gt;) for &lt;strong&gt;any unmatched&lt;/strong&gt; path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// we tell Express: "Send the HTML file and let React Router handle the URL."&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;FRONTEND_BUILD_PATH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;index.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ &lt;strong&gt;Result&lt;/strong&gt;: The browser loads &lt;code&gt;index.html&lt;/code&gt;, React takes over, and React Router reads the &lt;code&gt;/profile&lt;/code&gt; URL and &lt;strong&gt;displays the correct component&lt;/strong&gt;, making the single-page application experience seamless❗&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion❤️
&lt;/h1&gt;

&lt;p&gt;If you’re a beginner in backend development and these things didn’t make sense right away, don’t be disappointed, they can definitely be &lt;strong&gt;confusing at first&lt;/strong&gt;. I think we’ve all had these questions when we were &lt;strong&gt;just starting&lt;/strong&gt; out... I know I sure did❗ 🙃&lt;/p&gt;

&lt;p&gt;The main challenge is that we need to &lt;strong&gt;shift our mindset&lt;/strong&gt; and the &lt;strong&gt;way&lt;/strong&gt; we think, from the &lt;strong&gt;automatic&lt;/strong&gt;, in-memory serving of a frontend tool like Vite, to the &lt;strong&gt;more manual&lt;/strong&gt; and &lt;strong&gt;structured routing&lt;/strong&gt; approach of Express.&lt;/p&gt;

&lt;p&gt;I hope this article &lt;strong&gt;helps you out&lt;/strong&gt;, or maybe reminds you of the struggles you faced at the &lt;strong&gt;beginning&lt;/strong&gt; of your backend journey.🤗&lt;br&gt;
I’m really curious how many of us have gone through the same &lt;strong&gt;confusion at first&lt;/strong&gt;, leave me a comment if backend development gave you a &lt;strong&gt;hard tim&lt;/strong&gt;e too! I’d love to know I wasn’t the only one.🤗🥰&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Happy reading&lt;/strong&gt;, and if this article &lt;strong&gt;helped you&lt;/strong&gt; or you found it &lt;strong&gt;useful&lt;/strong&gt;, give it a reaction!🤗&lt;/p&gt;




&lt;p&gt;More articles: &lt;br&gt;
&lt;a href="https://dev.to/cristea_theodora_6200140b/nodejs-steps-for-building-your-first-server-547f"&gt;Node.js-Steps for building your first server❗&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/cristea_theodora_6200140b/from-zero-to-start-the-nodejs-fundamentals-you-need-to-know-part-i-32an"&gt;My First Node.js: Mastering the Fundamentals❗&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>backend</category>
      <category>beginners</category>
      <category>express</category>
    </item>
    <item>
      <title>Node.js-Steps for building your first server❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Wed, 15 Oct 2025 17:42:04 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/nodejs-steps-for-building-your-first-server-547f</link>
      <guid>https://dev.to/cristea_theodora/nodejs-steps-for-building-your-first-server-547f</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Hello everyone!👋 I’m happy to be back with the second part of my Node.js exploration. After setting up &lt;em&gt;&lt;a href="https://dev.to/cristea_theodora_6200140b/from-zero-to-start-the-nodejs-fundamentals-you-need-to-know-part-i-32an"&gt;My first Node.js – Mastering the Fundamentals&lt;/a&gt;&lt;/em&gt; in the previous post, today we’re taking a major step forward by &lt;strong&gt;taking the most important steps to create our first server&lt;/strong&gt;!🥰&lt;/p&gt;

&lt;p&gt;By the end of this post, you’ll have the basic knowledge needed to &lt;strong&gt;create a simple Node.js server&lt;/strong&gt;, handle &lt;strong&gt;HTTP requests&lt;/strong&gt;, serve &lt;strong&gt;static files&lt;/strong&gt;, and build a basic &lt;strong&gt;API&lt;/strong&gt;. This foundation will prepare you to build more complex backend applications with confidence.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdsyvbsyat0gy0ez4oif.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdsyvbsyat0gy0ez4oif.jpg" alt=" " width="476" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The concepts we’ll go through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;b&gt; Understanding the Event Loop&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;
&lt;b&gt; HTTP Module &amp;amp; Create Server&lt;/b&gt;: The HTTP Core&lt;/li&gt;
&lt;li&gt;&lt;b&gt; Req vs Res Objects&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt; Simple Routing&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;
&lt;b&gt; Loading Files&lt;/b&gt;: Serving Static Content&lt;/li&gt;
&lt;li&gt;
&lt;b&gt; Building a Simple API&lt;/b&gt;: API Structure&lt;/li&gt;
&lt;li&gt;
&lt;b&gt; Middleware&lt;/b&gt;: The Middleware Pattern&lt;/li&gt;
&lt;li&gt;
&lt;b&gt; Cleanup (Middleware &amp;amp; Handlers)&lt;/b&gt;: Code Organisation&lt;/li&gt;
&lt;li&gt;
&lt;b&gt; Get Req Body For POST&lt;/b&gt;: Handling Data&lt;/li&gt;
&lt;/ol&gt;




&lt;h1 id="event-loop"&gt;1. Understanding the Event Loop&lt;/h1&gt;

&lt;h4&gt;
  
  
  Definition
&lt;/h4&gt;

&lt;p&gt;The Event Loop it's the mechanism that make Node.js &lt;strong&gt;non-blocking&lt;/strong&gt;, &lt;strong&gt;asynchronous&lt;/strong&gt; and yet run on a &lt;strong&gt;single thread&lt;/strong&gt;. We can simply say that it’s the &lt;em&gt;traffic manager&lt;/em&gt; that decides &lt;strong&gt;when and how&lt;/strong&gt; operations are executed especially those that take time (like reading files, making HTTP requests...).&lt;/p&gt;

&lt;h3&gt;
  
  
  The logic is the following:
&lt;/h3&gt;

&lt;p&gt;→ Node.js &lt;strong&gt;receives&lt;/strong&gt; a request.&lt;br&gt;
→ If it’s a &lt;strong&gt;quick&lt;/strong&gt; operation (like a math calculation), it’s executed &lt;strong&gt;immediately&lt;/strong&gt; in the main thread.&lt;br&gt;
→ If it's a &lt;strong&gt;slow&lt;/strong&gt; operation (like making HTTP requests) Node.js &lt;strong&gt;delegates&lt;/strong&gt; it to a background thread (libuv thread pool) or the operating system.&lt;br&gt;
→ While the task &lt;strong&gt;run in the background&lt;/strong&gt;, the &lt;strong&gt;Event Loop&lt;/strong&gt; keep processing &lt;strong&gt;other requests.&lt;/strong&gt;&lt;br&gt;
→ When the background task &lt;strong&gt;finishes&lt;/strong&gt;, the result is placed into a &lt;strong&gt;queue&lt;/strong&gt;, and the Event Loop executes it once the main thread is &lt;strong&gt;free.&lt;/strong&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Imagine this as a simple analogy:
&lt;/h3&gt;

&lt;p&gt;(I hope this analogy makes more sense❗)&lt;br&gt;
...You’re a waiter in a restaurant,🙃&lt;br&gt;
→ You (the &lt;strong&gt;Event Loop&lt;/strong&gt;) take orders from customers (&lt;strong&gt;requests&lt;/strong&gt;),&lt;br&gt;
→ The chefs in the kitchen (&lt;strong&gt;thread pool&lt;/strong&gt;) cook the meals (&lt;strong&gt;long&lt;/strong&gt; operations).&lt;br&gt;
→ You don’t stand around waiting for one meal, you serve &lt;strong&gt;other&lt;/strong&gt; tables meanwhile.&lt;br&gt;
→ When the chefs finish, they notify you, and you deliver the food. This way, no customer gets stuck waiting, and everything &lt;strong&gt;runs efficiently&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5phj9sxtw6r11p79kv1f.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5phj9sxtw6r11p79kv1f.gif" alt=" " width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Simple code example:
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Timeout done&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;End&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//Output: &lt;/span&gt;
&lt;span class="nx"&gt;Start&lt;/span&gt;
&lt;span class="nx"&gt;End&lt;/span&gt;
&lt;span class="nx"&gt;Time&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;

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

&lt;/div&gt;




&lt;h1 id="http-create-server"&gt;2. HTTP Module &amp;amp; Create Server&lt;/h1&gt;

&lt;p&gt;The http module is a native, built-in Node.js library that provides the core functionalities for &lt;strong&gt;creating HTTP servers&lt;/strong&gt;. The essential method is &lt;code&gt;http.createServer()&lt;/code&gt;, which set up &lt;strong&gt;our server&lt;/strong&gt;. This method accepts a &lt;strong&gt;callback&lt;/strong&gt; function that executes every time a request received at the server, providing access to the &lt;code&gt;req&lt;/code&gt; (request) and &lt;code&gt;res&lt;/code&gt; (response) objects.&lt;/p&gt;


&lt;h3&gt;
  
  
  Simple Analogy
&lt;/h3&gt;

&lt;p&gt;We can say that our server works as the receptionist at a hotel.🙃&lt;/p&gt;

&lt;p&gt;→ &lt;code&gt;import http from 'http'&lt;/code&gt;: This is like hiring the receptionist and equipping them with the Instruction Manual (&lt;strong&gt;the HTTP Module&lt;/strong&gt;) on how to communicate with clients.&lt;br&gt;
→ &lt;code&gt;http.createServer((req, res) =&amp;gt; { ... })&lt;/code&gt;: This is setting the receptionist at the desk and establishing the fundamental rule: "Every time a client (&lt;code&gt;req&lt;/code&gt;) makes a &lt;strong&gt;request&lt;/strong&gt;, you must give them a &lt;strong&gt;response&lt;/strong&gt; (&lt;code&gt;res&lt;/code&gt;)."&lt;br&gt;
→ &lt;code&gt;server.listen(3000)&lt;/code&gt;: This is like installing a telephone(on a &lt;strong&gt;specific port&lt;/strong&gt;, like extension 3000) that clients can use to call and access your services.&lt;/p&gt;


&lt;h3&gt;
  
  
  Simple code example
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/plain&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server is running on http://localhost:3000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;http.createServer()&lt;/code&gt; → creates the server,&lt;br&gt;
&lt;code&gt;req&lt;/code&gt; → represents the incoming request,&lt;br&gt;
&lt;code&gt;res&lt;/code&gt; → represents the outgoing response.&lt;/p&gt;



&lt;h1 id="req-object"&gt;3. Req vs Res Objects&lt;/h1&gt;
&lt;h3&gt;
  
  
  The &lt;code&gt;req&lt;/code&gt; (Request) Object Definition:
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;req&lt;/code&gt; (Request) object is an instance of the IncomingMessage stream created by Node.js &lt;strong&gt;every time&lt;/strong&gt; the server receives an &lt;strong&gt;HTTP request&lt;/strong&gt;. It holds all the information &lt;strong&gt;sent&lt;/strong&gt; by the client, including the HTTP &lt;strong&gt;method&lt;/strong&gt; (GET, POST, etc.), the requested &lt;strong&gt;URL path&lt;/strong&gt;, and the full set of &lt;strong&gt;headers&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  The res (Response) Object Definition:
&lt;/h3&gt;

&lt;p&gt;The res (Response) object is a Writable Stream through which your server sends data &lt;strong&gt;back to the client&lt;/strong&gt;. Its role is to control exactly what the &lt;strong&gt;client receives&lt;/strong&gt; and &lt;strong&gt;how&lt;/strong&gt; they receive it, allowing you to set the HTTP &lt;strong&gt;Status Code&lt;/strong&gt;, define &lt;strong&gt;Headers&lt;/strong&gt; (like Content-Type), and send the response &lt;strong&gt;body&lt;/strong&gt;.&lt;/p&gt;


&lt;h3&gt;
  
  
  Simple Analogy
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;req&lt;/code&gt; →  represents the request coming from the client.&lt;br&gt;
It’s like a guest walking up to the receptionist and saying what they want:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"I’d like a single room for two nights."
"Can you tell me the check-out time?" 🙃
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ The receptionist (&lt;strong&gt;server&lt;/strong&gt;) receives this &lt;strong&gt;request&lt;/strong&gt; and reads it to understand what &lt;strong&gt;action&lt;/strong&gt; to take.&lt;br&gt;
→ So &lt;code&gt;req&lt;/code&gt; = the letter or message from the client to the receptionist.&lt;/p&gt;



&lt;p&gt;&lt;code&gt;res&lt;/code&gt;→ represents the &lt;strong&gt;response&lt;/strong&gt; the server sends back to the &lt;strong&gt;client&lt;/strong&gt;.&lt;br&gt;
It’s like the receptionist replying to the guest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Sure, your room is booked for two nights."
"Check-out is at 12:00 PM."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ The receptionist uses the information from the &lt;strong&gt;request&lt;/strong&gt; (&lt;code&gt;req&lt;/code&gt;) to provide the correct &lt;strong&gt;response&lt;/strong&gt; (&lt;code&gt;res&lt;/code&gt;).&lt;br&gt;
→ So &lt;code&gt;res&lt;/code&gt; = the &lt;strong&gt;response&lt;/strong&gt; or message from the receptionist to the &lt;strong&gt;client&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Simple code:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Path requested: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// we can set the Status Code and Header (using the res object)&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 

    &lt;span class="c1"&gt;// here we build and send the response body (using the res object)&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;`&amp;lt;h1&amp;gt;Hello from Node.js!&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;You asked for the path: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;`&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Server running at port &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// server starts on the specified port&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1 id="simple-routing"&gt;4. Simple Routing&lt;/h1&gt;

&lt;h3&gt;
  
  
  Definition
&lt;/h3&gt;

&lt;p&gt;Routing is simply &lt;strong&gt;how&lt;/strong&gt; your server decides &lt;strong&gt;where to send&lt;/strong&gt; an incoming request. Think of it as looking at the address (the &lt;strong&gt;URL path&lt;/strong&gt;) and the goal (the HTTP Method, like &lt;code&gt;GET&lt;/code&gt; or &lt;code&gt;POST&lt;/code&gt;) to figure out which piece of code (&lt;code&gt;handler&lt;/code&gt;) should run to create the correct response.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;//create server&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//could be GET/POST/PUT/DELETE...&lt;/span&gt;

    &lt;span class="c1"&gt;//here we set default headers for a standard response&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//type html&lt;/span&gt;

    &lt;span class="c1"&gt;// 1. basic routing based on URL&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;h1&amp;gt;Home Page!&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; 

    &lt;span class="c1"&gt;//2. we check if the route is 'api/users and the method GET&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//request was successful,&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;h1&amp;gt;User List&amp;lt;/h1&amp;gt;&amp;lt;p&amp;gt;GET request received.&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; 

    &lt;span class="c1"&gt;// 4. we handling 404 if is not exist&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//not found&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;h1&amp;gt;404 Not Found&amp;lt;/h1&amp;gt;&amp;lt;p&amp;gt;The requested resource does not exist.&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server running at port 8000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;






&lt;h1 id="loading-file"&gt;5. Loading Files&lt;/h1&gt;

&lt;h3&gt;
  
  
  Definition
&lt;/h3&gt;

&lt;p&gt;→ Serving Static Content means sending files that &lt;strong&gt;don't change&lt;/strong&gt; (like your main index.html, style sheets, images, or client-side JavaScript) &lt;strong&gt;directly to the client&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;→ For these type of files, native Node.js uses the &lt;strong&gt;built-in&lt;/strong&gt; &lt;code&gt;fs&lt;/code&gt; (File System) &lt;strong&gt;module&lt;/strong&gt; to read the file's contents from the disk. It's important to set the &lt;strong&gt;correct&lt;/strong&gt; &lt;code&gt;Content-Type&lt;/code&gt; in the response header so the browser knows how to render the content (e.g., as HTML, not plain text).&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs/promises&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;fileURLToPath&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;url&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//__dirname gives the directory of the current module&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;__dirname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fileURLToPath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;//create server&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 

        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;index.html`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

          &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error loading index.html:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Internal Server Error&lt;/span&gt;
            &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;h1&amp;gt;500 Server Error Loading File&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// ... (other routing logic)&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;h1&amp;gt;404 Not Found&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Server running at port 8000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;






&lt;h1 id="build-api"&gt;6. Building a Simple API&lt;/h1&gt;

&lt;h3&gt;
  
  
  Definition
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;well-structured API&lt;/strong&gt; isn't just nice to look at it's intuitive to use. Think of your endpoints as the &lt;strong&gt;nouns&lt;/strong&gt; (resources) in your application, and the HTTP methods as the &lt;strong&gt;verbs&lt;/strong&gt; (actions).&lt;/p&gt;

&lt;p&gt;→ When it comes to &lt;strong&gt;structuring your API&lt;/strong&gt;, my advice is to use plural nouns in lowercase for your resource paths. Avoid putting verbs directly in the &lt;strong&gt;endpoint path&lt;/strong&gt;, the HTTP method itself already **describes*8 the action.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Wrong: GET /get-all-users&lt;br&gt;
 → Correct: GET /users&lt;/p&gt;

&lt;p&gt;Wrong: POST /create-post&lt;br&gt;
 → Correct: POST /posts&lt;/p&gt;

&lt;p&gt;Our API should be &lt;strong&gt;predictable&lt;/strong&gt;. When someone visits &lt;strong&gt;/users&lt;/strong&gt;, it should clearly indicate that they're dealing with the &lt;strong&gt;user resource&lt;/strong&gt;. This consistency makes our API easier to understand and more &lt;strong&gt;RESTful&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// GET /posts&lt;/span&gt;
&lt;span class="c1"&gt;// the purpose: receiving a list of all posts &lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Logic to fetch all posts from the database&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Fetching all posts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; 
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// GET /posts/:id&lt;/span&gt;
&lt;span class="c1"&gt;// the purpose: receiving a specific post by ID &lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/:id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// here we extracting the resource ID from the URL&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

    &lt;span class="c1"&gt;// logic to fetch post 'postId'&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Fetching post &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;postId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// POST /posts&lt;/span&gt;
&lt;span class="c1"&gt;// the purpose: create a new post&lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Logic to create a new post using req.body&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Post created successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1 id="middleware"&gt;7. Middleware&lt;/h1&gt;

&lt;h3&gt;
  
  
  Definition
&lt;/h3&gt;

&lt;p&gt;→Middleware is basically a function that &lt;strong&gt;runs between&lt;/strong&gt; the time a request reaches our server and the time a response is sent back. It has access to the request (&lt;code&gt;req&lt;/code&gt;), the response (&lt;code&gt;res&lt;/code&gt;), and a &lt;code&gt;next()&lt;/code&gt; function that decides what happens next. &lt;/p&gt;

&lt;p&gt;→If the middleware doesn’t finish the request itself, it calls &lt;code&gt;next()&lt;/code&gt; to let the &lt;strong&gt;next piece of code&lt;/strong&gt; handle it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;//the middleware function runs before every request handler&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// here we log the current time, HTTP method, and requested URL&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;] &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// we call next() to pass control to the next middleware or route&lt;/span&gt;
  &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;//  and we apply the middleware to all routes in the app&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Example route, handles GET requests to /users&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// just send a simple text response&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;List of users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Start the server on port 8000&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Server running on port 8000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

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

&lt;/div&gt;






&lt;h1 id="cleanup-middleware"&gt;8. Cleanup (Middleware &amp;amp; Handlers):&lt;/h1&gt;

&lt;p&gt;→Code organization is about how we structure our project so it’s clean, readable, and easy to maintain. It means separating our code into logical parts, so that routes, middleware, and core logic don’t all live in the same file.&lt;/p&gt;

&lt;h3&gt;
  
  
  The logic is the following:
&lt;/h3&gt;

&lt;p&gt;→ &lt;strong&gt;Separate responsibilities&lt;/strong&gt; - each file or function should do one thing well.&lt;br&gt;
→ &lt;strong&gt;Keep routes simple&lt;/strong&gt; - no business logic directly inside routes.&lt;br&gt;
→ &lt;strong&gt;Use folders for structure&lt;/strong&gt; (routes/, controllers/, middleware/, etc.).&lt;br&gt;
→ &lt;strong&gt;Handle errors properly&lt;/strong&gt; using a global error handler.&lt;br&gt;
→ &lt;strong&gt;Name clearly&lt;/strong&gt; - your folder and file names should describe their purpose.&lt;/p&gt;




&lt;h3&gt;
  
  
  Simple code
&lt;/h3&gt;

&lt;h5&gt;
  
  
  app.js file
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;userRoutes&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./routes/users.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;errorHandler&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./middleware/errorHandler.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="c1"&gt;// here we use the user routes&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;userRoutes&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// here we have a global error handler&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;errorHandler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Server running on port 3000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  routes/users.js file
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getUsers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createUser&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../controllers/users.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// our routes should be simple, just map endpoints to controller functions&lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getUsers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;






&lt;h1 id="get-req-post"&gt;9. Get Req Body For POST&lt;/h1&gt;

&lt;p&gt;→ Handling the request body means reading the data a client sends to our &lt;strong&gt;server&lt;/strong&gt;, usually when creating or updating something (like &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, or &lt;code&gt;PATCH&lt;/code&gt; requests...).&lt;br&gt;
→ This data often comes as JSON or URL-encoded form data, and we need to parse it so our code can use it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Points we should understand
&lt;/h3&gt;

&lt;p&gt;→ &lt;strong&gt;Raw data first&lt;/strong&gt;: When the server receives a request, the body comes in as a raw stream, it’s just a bunch of bytes.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Parsing is required&lt;/strong&gt;: we need middleware to turn that raw data into something usable, like a JavaScript object.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Content-Type matters&lt;/strong&gt;: the client must send the &lt;strong&gt;correct&lt;/strong&gt; &lt;code&gt;Content-Type&lt;/code&gt; header (e.g., application/json) so the server knows how to &lt;strong&gt;parse&lt;/strong&gt; the data.&lt;/p&gt;

&lt;p&gt;My advice use built-in framework parsers (like express.json() in Express) early in your application's setup to automatically populate the req.body property.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// middleware to parse JSON bodies&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="c1"&gt;// POST route to create a new user&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// req.body already parsed&lt;/span&gt;

  &lt;span class="c1"&gt;// we us a basic validation&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Name and email are required&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// here we simulate the creation of a new user&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;User created!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;newUser&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Server running on port 3000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;→ Here express.json() parses incoming JSON requests automatically.&lt;br&gt;
→ &lt;code&gt;req.body&lt;/code&gt; now contains a normal JavaScript object.&lt;br&gt;
→ By doing this, the route handler can read, validate, and use that data directly.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion ❤️
&lt;/h1&gt;

&lt;p&gt;I hope this post is helpful and maybe even helps improve your understanding of Node.js fundamentals.🤗 I haven’t gone into too much detail, but I’ll be back with more Node.js content in future posts.&lt;/p&gt;

&lt;p&gt;If you enjoyed this post, found it helpful, or it just sparked your curiosity, feel free to leave a comment or give it a reaction, I’d really appreciate it!🤗&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Happy coding, and see you in the next post!&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>node</category>
      <category>backend</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>My First Node.js: Mastering the Fundamentals❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Fri, 10 Oct 2025 18:10:02 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/from-zero-to-start-the-nodejs-fundamentals-you-need-to-know-part-i-32an</link>
      <guid>https://dev.to/cristea_theodora/from-zero-to-start-the-nodejs-fundamentals-you-need-to-know-part-i-32an</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;Hey everyone! Lately, I've been focusing heavily on &lt;strong&gt;backend development&lt;/strong&gt;, and I finally decided it was time to dive into Node.js. I'd been putting this moment off for a while, and now &lt;strong&gt;it's here❗&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Honestly, I used to feel a bit intimidated when thinking about backend concepts-things like &lt;strong&gt;creating servers&lt;/strong&gt;, &lt;strong&gt;working with databases&lt;/strong&gt;...😳and general infrastructure.I wasn't sure what Node.js had in store for me...until just a few days ago.🤗&lt;/p&gt;

&lt;p&gt;To my surprise, I genuinely &lt;strong&gt;love it&lt;/strong&gt;! It's quite accessible and logical in how it operates, especially since I already have JavaScript knowledge.&lt;/p&gt;

&lt;p&gt;There's still a vast &lt;strong&gt;amount to learn&lt;/strong&gt; in the backend world, but I'm not focused on achieving perfection; I'm focused on the &lt;strong&gt;progress itself&lt;/strong&gt;. The prospect of implementing these acquired skills in future projects is &lt;strong&gt;highly motivating&lt;/strong&gt;, and I'm keen to move forward!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wish me luck on this journey&lt;/strong&gt;!😬 Hopefully I don’t &lt;em&gt;break&lt;/em&gt; any server while learning Node.js!😂&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h717ckqgzhl2mcoo0so.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h717ckqgzhl2mcoo0so.jpg" alt=" " width="500" height="344"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;On a serious note, here’s what we’ll cover in detail in this first section:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;1. Setting the Stage&lt;/b&gt;: Installation, REPL, and &lt;code&gt;package.json&lt;/code&gt;&lt;br&gt;
&lt;b&gt;2. Modularity&lt;/b&gt;: Understanding Modules (CommonJS vs. ES Modules)&lt;br&gt;
&lt;b&gt;3. The Workflow&lt;/b&gt;: NPM Scripts, Nodemon, and &lt;code&gt;.gitignore&lt;/code&gt;&lt;br&gt;
&lt;b&gt;4. Security Baseline&lt;/b&gt;: Environment Variables and the &lt;code&gt;.env&lt;/code&gt; file&lt;/p&gt;


&lt;h1&gt;
  
  
  What is Node.js?
&lt;/h1&gt;

&lt;p&gt;Node.js is a JavaScript runtime built on Chrome's V8 engine that allows you to &lt;strong&gt;run JavaScript on the server side&lt;/strong&gt;. Unlike traditional JavaScript, which runs &lt;strong&gt;in the browser&lt;/strong&gt;, Node.js enables you to build &lt;strong&gt;server-side applications&lt;/strong&gt;, manage files and databases, create APIs, and much more using the &lt;strong&gt;same language&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Node.js is commonly used for server-side and back-end development, including:&lt;/p&gt;

&lt;p&gt;➤ Web servers and real-time applications,&lt;br&gt;
➤ REST or GraphQL APIs for communication between front-end and back-end,&lt;br&gt;
➤ Database management (MongoDB, PostgreSQL, MySQL, etc.)&lt;br&gt;
➤ Automation and server-side scripts,&lt;br&gt;
➤ Microservices and scalable applications, thanks to its asynchronous, event-driven architecture.&lt;/p&gt;



&lt;h2 id="setting-the-stage"&gt;1. Setting the Stage&lt;/h2&gt;

&lt;p&gt;Before we write a single line of server code, we need to ensure we have the runtime environment installed and that our project is properly initialized!&lt;/p&gt;

&lt;h3&gt;1.a)  Installation:&lt;/h3&gt;

&lt;p&gt;The very first step is, obviously, getting Node.js into your system.&lt;br&gt;
These commands should display the installed versions, confirming that both the Node.js engine and NPM (Node Package Manager) are ready to go.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node -v
npm -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;1.b) Node REPL (The Instant Playground): &lt;/h3&gt;

&lt;p&gt;REPL (Read-Eval-Print Loop) is atool for quickly testing a function, new syntax, or a native module without writing and saving an entire file.&lt;br&gt;
test cod:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node
&amp;gt; console.log("Hello, Node.js!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;1.c) package.json: &lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;package.json&lt;/code&gt; is arguably the most crucial file in a Node.js project. It is the identity card of your application.&lt;br&gt;
To create this file, navigate to your project directory and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So far, it feels &lt;strong&gt;like a simple&lt;/strong&gt;, &lt;em&gt;familiar cake&lt;/em&gt;, right?🤗&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsz2pxa7qzmzfowdfggg8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsz2pxa7qzmzfowdfggg8.jpg" alt=" " width="532" height="474"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2 id="modularity"&gt;2. Modularity&lt;/h2&gt;

&lt;p&gt;A key component of any robust Node.js project is how code is organized and shared across &lt;strong&gt;separate files&lt;/strong&gt;. Node.js currently supports &lt;strong&gt;two major module systems&lt;/strong&gt;. Understanding the difference is crucial for you!&lt;/p&gt;

&lt;h3&gt;2.a) CommonJS (CJS) - The Classic&lt;/h3&gt;

&lt;p&gt;This was the original and long-standing standard system in Node.js.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;: Uses the &lt;code&gt;require()&lt;/code&gt; function and &lt;code&gt;module.exports&lt;/code&gt;.&lt;br&gt;
&lt;strong&gt;Execution&lt;/strong&gt;: Module loading is synchronous (it stops execution until the module is fully loaded).&lt;br&gt;
&lt;strong&gt;Usage&lt;/strong&gt;: It's the default for files with the &lt;code&gt;.js&lt;/code&gt; extension unless otherwise specified.&lt;/p&gt;

&lt;p&gt;example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// exporting module
module.exports &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  add: &lt;span class="o"&gt;(&lt;/span&gt;a, b&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; a + b
&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// importing module
const &lt;span class="o"&gt;{&lt;/span&gt; add &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./math'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
console.log&lt;span class="o"&gt;(&lt;/span&gt;add&lt;span class="o"&gt;(&lt;/span&gt;5, 5&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;2.b) ES Modules (ESM) - The Modern Standard&lt;/h3&gt;

&lt;p&gt;ESM is the official JavaScript standard (introduced in ES6) and is now fully supported and recommended in Node.js for new projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;: Uses the &lt;code&gt;import&lt;/code&gt; and export &lt;code&gt;keywords&lt;/code&gt;.&lt;br&gt;
&lt;strong&gt;Execution&lt;/strong&gt;: Supports asynchronous loading and is generally more efficient.&lt;br&gt;
&lt;strong&gt;Usage&lt;/strong&gt;: Requires either the &lt;code&gt;.mjs&lt;/code&gt; extension or setting &lt;code&gt;"type": "module"&lt;/code&gt; in your &lt;code&gt;package.json file&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// exporting module
&lt;span class="nb"&gt;export &lt;/span&gt;const subtract &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;a, b&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; a - b&lt;span class="p"&gt;;&lt;/span&gt;

// importing module
import &lt;span class="o"&gt;{&lt;/span&gt; subtract &lt;span class="o"&gt;}&lt;/span&gt; from &lt;span class="s1"&gt;'./math.js'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
console.log&lt;span class="o"&gt;(&lt;/span&gt;subtract&lt;span class="o"&gt;(&lt;/span&gt;10, 3&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I suggest you &lt;strong&gt;be careful&lt;/strong&gt; when working with modules, ES Modules are the modern standard, but make sure you know what type of module your project uses before importing anything. &lt;strong&gt;I actually ran into this myself at first❗&lt;/strong&gt;🙃&lt;/p&gt;




&lt;h2 id="workflow"&gt;3. The Workflow&lt;/h2&gt;

&lt;p&gt;These functionalities will help you automate and streamline your workflow, saving time and avoiding repetitive tasks.&lt;/p&gt;

&lt;h3&gt;3.a) NPM Scripts &lt;/h3&gt;

&lt;p&gt;Automate terminal commands directly from your &lt;code&gt;package.json&lt;/code&gt;.&lt;br&gt;
For example, you can create a script to start the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// package.json
"scripts": {
  "start": "node server.js",
  "dev": "nodemon server.js"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, you run them easily with: &lt;code&gt;npm run start&lt;/code&gt; or &lt;code&gt;npm run dev&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;3.b) Nodemon(The Automatic Refresher)&lt;/h3&gt;

&lt;p&gt;Nodemon is an essential development-only NPM package. &lt;strong&gt;Why is it crucial&lt;/strong&gt;❓It automatically monitors changes in your source files and &lt;strong&gt;restarts your Node.js server every time you save&lt;/strong&gt;.&lt;br&gt;
Installation (as a dev dependency): &lt;code&gt;npm install -D nodemon&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;3.c) .gitignore (Keeping GitHub Clean)&lt;/h3&gt;

&lt;p&gt;This file &lt;strong&gt;is vital for maintaining a clean and secure repository&lt;/strong&gt;. It instructs Git which files and directories to &lt;strong&gt;ignore&lt;/strong&gt; during a commit.&lt;br&gt;
&lt;strong&gt;Must-Ignore&lt;/strong&gt;: The two most critical items to ignore are the &lt;code&gt;node_modules&lt;/code&gt; directory (huge!) and the &lt;code&gt;.env&lt;/code&gt; file (sensitive data!).&lt;/p&gt;



&lt;h2 id="security-baseline"&gt;4. Security Baseline&lt;/h2&gt;

&lt;p&gt;We will have sensitive information that &lt;strong&gt;should never be committed to source&lt;/strong&gt; control (like GitHub). This includes API keys, database passwords, and specific configuration settings for different environments.This is where Environment Variables come in, example of &lt;code&gt;.env&lt;/code&gt; page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_HOST=localhost
DB_PORT=5432
API_KEY=my_super_secret_key_12345
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Very important!&lt;/strong&gt; Remember to always include the &lt;code&gt;.env&lt;/code&gt; file in your &lt;code&gt;.gitignore&lt;/code&gt;❗ This ensures your secrets stay local and secure.&lt;/p&gt;




&lt;h2 id="conclusion"&gt;Conclusion❤️&lt;/h2&gt;

&lt;p&gt;So far, everything seems straightforward! Of course, I'll continue in the next post with a deep dive into &lt;strong&gt;how to create your first own server&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I'm committed to posting my learnings here with all of you, both for those who want a recap and for myself-as they say, &lt;strong&gt;you learn fastest by explaining to someone else.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm genuinely excited to have stepped into the &lt;strong&gt;backend world&lt;/strong&gt;. It feels like a new beginning and has opened up new paths that really spark &lt;strong&gt;my curiosity&lt;/strong&gt;. If you're reading this, you're either already familiar with Node.js or you're planning to learn it, so &lt;strong&gt;be proud of where you are right now&lt;/strong&gt;. You're doing great, and you're &lt;strong&gt;exactly where you need to be&lt;/strong&gt;! Keep coding! &lt;/p&gt;

&lt;p&gt;I highly recommend you check the documentation as well &lt;a href="https://nodejs.org/docs/latest/api/" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;.&lt;br&gt;
Don't &lt;strong&gt;overlook the official documentation&lt;/strong&gt;! Tools and quick searches are perfect for immediate needs, but the documentation is where you'll &lt;strong&gt;find the complete&lt;/strong&gt;, official context necessary for learning more about Node.js.&lt;/p&gt;

&lt;p&gt;And if you enjoyed this post, &lt;strong&gt;please leave a comment or a reaction&lt;/strong&gt;❤️! &lt;strong&gt;I truly appreciate the gesture&lt;/strong&gt; and the fact that you took the time to read my work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good luck and happy coding!&lt;/strong&gt;🤗&lt;/p&gt;




</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>node</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Build Your Own Infinite Carousel in React (with a Custom Hook)❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Mon, 15 Sep 2025 00:46:32 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/build-your-own-infinite-carousel-in-react-with-a-custom-hook-1g29</link>
      <guid>https://dev.to/cristea_theodora/build-your-own-infinite-carousel-in-react-with-a-custom-hook-1g29</guid>
      <description>&lt;p&gt;Hey!🥰 It’s been a while since my last post…&lt;br&gt;
&lt;strong&gt;No ofcorse, I haven’t quit web development&lt;/strong&gt;,🙃 and nope, I didn’t go on a long vacation either.🙃 Quite the opposite - I’ve been coding non-stop, 6 out of 7 days. I’ve been busy with a project that I’ll share with you soon, but today &lt;strong&gt;I want to show you something smaller but really useful:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;➤ How I built a reusable &lt;strong&gt;infinite carousel in React&lt;/strong&gt;, using only a custom hook, a component, and some CSS.&lt;br&gt;
GitHub: &lt;a href="https://github.com/Theodora-11/carousel" rel="noopener noreferrer"&gt;Carousel&lt;/a&gt;&lt;br&gt;
Demo: &lt;a href="https://create-carousel.netlify.app/" rel="noopener noreferrer"&gt;Carousel&lt;/a&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  Why another carousel❓
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Carousels are everywhere&lt;/strong&gt;: online shops, landing pages, portfolios… and let’s be honest, many developers reach for a big library when all they need is a &lt;strong&gt;simple slider&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;There’s &lt;strong&gt;nothing wrong&lt;/strong&gt; with libraries, but sometimes it’s good to &lt;strong&gt;be curious and understand&lt;/strong&gt; the logic behind them. Building one yourself gives you full control and help you creating &lt;strong&gt;your own mini-library&lt;/strong&gt;.&lt;/p&gt;


&lt;h1&gt;
  
  
  What does an &lt;em&gt;infinite carousel&lt;/em&gt; mean❓
&lt;/h1&gt;

&lt;p&gt;A classic carousel has a beginning and an end. If you reach the last image and click “next,” it &lt;strong&gt;either stops or jumps back abruptly&lt;/strong&gt;. An infinite carousel creates the illusion that the &lt;strong&gt;list never ends&lt;/strong&gt;.&lt;br&gt;
How❓&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clone a few slides&lt;/strong&gt; and add them to the &lt;strong&gt;beginning and end&lt;/strong&gt;.&lt;br&gt;
When you move too far left or right, instantly reposition the list without the &lt;strong&gt;user noticing.&lt;/strong&gt; This trick gives the user the feeling they &lt;strong&gt;can scroll endlessly&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;Sounds a bit confusing&lt;/strong&gt;❓Don’t worry, &lt;strong&gt;keep reading&lt;/strong&gt; and it will all make sense.🥰&lt;/p&gt;


&lt;h2&gt;
  
  
  Project structure:
&lt;/h2&gt;

&lt;p&gt;I split the logic into two parts:&lt;br&gt;
• &lt;strong&gt;InfiniteCarousel component&lt;/strong&gt; ➤  handles the UI (images, titles, navigation buttons).&lt;br&gt;
• &lt;strong&gt;useCarousel hook&lt;/strong&gt; ➤  handles the logic (clones, index, transitions, auto-slide, resize).&lt;br&gt;
This makes the carousel reusable: you can drop the hook into &lt;strong&gt;any React project&lt;/strong&gt; and use it with &lt;strong&gt;any type of content&lt;/strong&gt;.&lt;/p&gt;


&lt;h3&gt;
  
  
  The useCarousel hook
&lt;/h3&gt;

&lt;p&gt;The hook accepts a few configuration options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useCarousel&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;visibleSlides&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;           &lt;span class="c1"&gt;// how many slides are visible at once&lt;/span&gt;
  &lt;span class="na"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                    &lt;span class="c1"&gt;// spacing between them&lt;/span&gt;
  &lt;span class="na"&gt;autoSlideInterval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;    &lt;span class="c1"&gt;// autoplay interval in ms&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What it does under the hood&lt;/strong&gt;❓&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Index tracking:&lt;/strong&gt; ➤  keeps track of the current position with a ref.&lt;br&gt;
• &lt;strong&gt;Transitions&lt;/strong&gt; ➤  moves the carousel with translateX.&lt;br&gt;
• &lt;strong&gt;Invisible reset&lt;/strong&gt; ➤  when you go past the edges, it disables transition, instantly repositions, then continues normally.&lt;br&gt;
• &lt;strong&gt;Auto-slide&lt;/strong&gt; ➤ moves slides automatically, pauses on hover.&lt;br&gt;
• &lt;strong&gt;Resize handler&lt;/strong&gt; ➤ recalculates slide widths when the window size changes.&lt;/p&gt;
&lt;h3&gt;
  
  
  The InfiniteCarousel component
&lt;/h3&gt;

&lt;p&gt;The UI is quite straightforward:&lt;br&gt;
• ul for the list of slides,&lt;br&gt;
• li for each image,&lt;br&gt;
• two buttons for manual navigation.&lt;/p&gt;


&lt;h2&gt;
  
  
  Responsive design
&lt;/h2&gt;

&lt;p&gt;With some media queries, the carousel adapts to different screen sizes:&lt;br&gt;
• On mobile → 1–2 slides visible,&lt;br&gt;
• On tablet → 3 slides,&lt;br&gt;
• On desktop → 4 slides.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.li-right-tea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;50%&lt;/span&gt; &lt;span class="n"&gt;-&lt;/span&gt; &lt;span class="m"&gt;32px&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;900px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.li-right-tea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;33.33%&lt;/span&gt; &lt;span class="n"&gt;-&lt;/span&gt; &lt;span class="m"&gt;64px&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.li-right-tea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;25%&lt;/span&gt; &lt;span class="n"&gt;-&lt;/span&gt; &lt;span class="m"&gt;96px&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Visual scheme of the logic
&lt;/h2&gt;

&lt;p&gt;Let’s say we have &lt;strong&gt;8 original slides: A B C D E F G H&lt;/strong&gt; We want 4 visible at once ➤  that means we clone &lt;strong&gt;4 at the beginning and 4 at the end.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe22us35q7n0xm5l4zt8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe22us35q7n0xm5l4zt8w.png" alt=" " width="800" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key positions:
&lt;/h2&gt;

&lt;p&gt;• &lt;strong&gt;Start (index = 4)&lt;/strong&gt; ➤ aligned on the first real slide (A)&lt;br&gt;
Visible: [ A | B | C | D ]&lt;br&gt;
• &lt;strong&gt;Going right (next)&lt;/strong&gt;:&lt;br&gt;
You reach index 11 (H).&lt;br&gt;
Next click ➤ index 12 (A clone).&lt;br&gt;
➤ On transitionend, it instantly resets back to index 4 (A real).&lt;br&gt;
• &lt;strong&gt;Going left (prev)&lt;/strong&gt;:&lt;br&gt;
You reach index 3 (H clone).&lt;br&gt;
➤ On transitionend, it instantly resets back to index 11 (H real).&lt;br&gt;
The user never sees the*jump* The illusion of infinity is preserved.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final functionality
&lt;/h1&gt;

&lt;p&gt;• Manual navigation with buttons,&lt;br&gt;
• Auto-slide with customizable interval,&lt;br&gt;
• Pause on hover,&lt;br&gt;
• Invisible reset for infinite effect,&lt;br&gt;
• Responsive (media queries + resize recalculation),&lt;br&gt;
• Reusable (hook works with any type of content, not just images).&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion❤️
&lt;/h1&gt;

&lt;p&gt;Now you have a &lt;strong&gt;fully working infinite carousel in React,&lt;/strong&gt; built from scratch, with &lt;strong&gt;no external libraries&lt;/strong&gt;, and with &lt;strong&gt;full control over the behavior&lt;/strong&gt;.🥰Of course, it can be enhanced with indicators (dots) for progress, animations, and other functionalities! I think building your own &lt;em&gt;mini-libraries&lt;/em&gt; in React is worth it. You not only learn how things work under the hood, but you also &lt;strong&gt;get the freedom to extend&lt;/strong&gt; and customize them however &lt;strong&gt;you like.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I hope this post helps you!🥰&lt;/strong&gt; For me, rewriting it was a great way to solidify my understanding. Let me know in the comments if you have questions or if this was useful for you.&lt;br&gt;
&lt;strong&gt;Happy coding!&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>react</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>css</category>
    </item>
    <item>
      <title>11 Months as a Self-Taught Developer – What Have I Learned?</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Sun, 03 Aug 2025 10:43:56 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/11-months-as-a-self-taught-developer-what-have-i-learned-g8p</link>
      <guid>https://dev.to/cristea_theodora/11-months-as-a-self-taught-developer-what-have-i-learned-g8p</guid>
      <description>&lt;p&gt;Hello everyone!🥰&lt;br&gt;
I haven’t been in this community for long, so like any newcomer, I wasn’t sure exactly what to share in my first posts.&lt;br&gt;
&lt;strong&gt;There’s so much to say&lt;/strong&gt;, you never really know what topic to post about until you place your hands on the keyboard.&lt;br&gt;
So today, I want to share with you what I’ve learned over these &lt;strong&gt;11 months as a self-taught developer&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  In the beginning...
&lt;/h2&gt;

&lt;p&gt;• Let me start by saying &lt;strong&gt;it wasn’t easy&lt;/strong&gt;. I didn’t just struggle with the programming languages themselves HTML, CSS, JS, but even my laptop &lt;strong&gt;wasn’t very friendly&lt;/strong&gt; with me at the start. Everything was new. I started by writing my first lines of code in Notepad, manually typing every piece.&lt;/p&gt;

&lt;p&gt;• Now I realize &lt;strong&gt;how much that helped me&lt;/strong&gt; understand the syntax, where to place curly braces, quotation marks, commas... whereas in Visual Studio, some things are added automatically. It was &lt;strong&gt;chaotic&lt;/strong&gt;, the way I wrote code, the number of lines just to trigger a simple button event...🙃&lt;/p&gt;

&lt;p&gt;• Later on, I began learning Git commands. At first, they seemed &lt;strong&gt;overwhelming and meaningless&lt;/strong&gt;, but I focused on the ones I used most often, and gradually I started recognizing more and more of them.&lt;br&gt;
Even now, I still discover new ones or revisit old ones I’ve forgotten.😄&lt;br&gt;
Not long ago, I also started &lt;strong&gt;learning React and TypeScript&lt;/strong&gt;. I still have a lot to learn, but I feel comfortable with the basics and can build projects with them.&lt;/p&gt;

&lt;p&gt;• Slowly, things started to &lt;strong&gt;make sense&lt;/strong&gt;.🤗 I got used to the syntax, the logic of the languages, I began creating small games, giving life to my &lt;strong&gt;curiosity&lt;/strong&gt;, despite the fear of the &lt;strong&gt;unknown&lt;/strong&gt;. I knew it would be hard, that it would take &lt;strong&gt;time&lt;/strong&gt; and effort, but I didn’t let that overwhelm me. I put my fears and inner voice aside and started planning my learning path.&lt;/p&gt;




&lt;h2&gt;
  
  
  On a personal note...
&lt;/h2&gt;

&lt;p&gt;• Even though everything &lt;strong&gt;was new&lt;/strong&gt; and it felt like this &lt;em&gt;reading&lt;/em&gt; would never end, I realized &lt;strong&gt;I don’t have to be perfect&lt;/strong&gt;. I don’t have to learn &lt;strong&gt;every little&lt;/strong&gt; detail. If I had tried to do that, I’d probably still be studying just CSS...🙃&lt;/p&gt;

&lt;p&gt;• You don’t need to know everything perfectly. These languages were designed &lt;strong&gt;over years by teams of people&lt;/strong&gt;, not by just one brain.&lt;br&gt;
You &lt;strong&gt;can’t&lt;/strong&gt; possibly learn an entire language in just a &lt;strong&gt;few months&lt;/strong&gt; and then say: &lt;em&gt;Alright, time for the next one...!&lt;/em&gt; It’s like trying to learn several spoken languages at once and wanting to master them perfectly in no time, your brain &lt;strong&gt;will eventually crash&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;• In the beginning, the basics matter most. As you progress, you can build on them with intermediate concepts but &lt;strong&gt;don’t let&lt;/strong&gt; those &lt;strong&gt;overwhelm&lt;/strong&gt; you too soon. &lt;br&gt;
&lt;strong&gt;Why⁉️&lt;/strong&gt; Because you’ll feel discouraged. You’ll feel like you’re just learning to check things off a roadmap, but you &lt;strong&gt;won’t see real progress&lt;/strong&gt; using the knowledge you already have. And your inner voice will start saying: &lt;em&gt;There’s too much to learn, too much to process, too much to memorize... give me a break&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;• That’s when I realized: You have to &lt;strong&gt;work with your brain&lt;/strong&gt;, not against it.🤗 Take breaks, even a &lt;strong&gt;few days off&lt;/strong&gt;. That’s not wrong. Relax. Give yourself &lt;strong&gt;time&lt;/strong&gt; to process what you’ve learned. Don’t overload yourself with too many concepts at once.&lt;strong&gt;Use short&lt;/strong&gt;, focused work sessions. &lt;strong&gt;It’s not about how many hours&lt;/strong&gt; you sit in front of the computer, if you’re tired and unfocused, you’ve only truly studied for 2–3 of those hours. But if you’re &lt;strong&gt;well-rested&lt;/strong&gt; and focused for just &lt;strong&gt;2-3 hours a day&lt;/strong&gt;, you’ll feel the difference in learning and progress.&lt;/p&gt;

&lt;p&gt;• It’s not &lt;strong&gt;about&lt;/strong&gt; how long you study, it’s about &lt;strong&gt;consistency&lt;/strong&gt;. Doing a bit every day matters more than cramming once a week. Being &lt;strong&gt;present, showing up, continuing,&lt;/strong&gt; that’s what builds progress.🤗&lt;/p&gt;




&lt;h2&gt;
  
  
  About that inner voice...
&lt;/h2&gt;

&lt;p&gt;• My inner voice used to work &lt;strong&gt;against me&lt;/strong&gt;. It doubted me. It told me I couldn’t do it. That it wasn’t for me. &lt;strong&gt;Why⁉️&lt;/strong&gt; Because I never proved it wrong. I let it speak. I listened. But then, I stopped listening and &lt;br&gt;
started &lt;strong&gt;proving it wrong.&lt;/strong&gt; I thought that way because I wasn’t &lt;strong&gt;practicing&lt;/strong&gt; enough. I wasn’t &lt;strong&gt;building projects&lt;/strong&gt;, just collecting knowledge in my head, unorganized.&lt;/p&gt;

&lt;p&gt;• That made me feel &lt;strong&gt;overwhelmed&lt;/strong&gt;, and gave that inner voice all the power. But when I started applying what I was learning, building projects, &lt;strong&gt;putting things in order&lt;/strong&gt;, that’s when my confidence &lt;strong&gt;grew&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;• We started to &lt;strong&gt;become friends&lt;/strong&gt;.🙃 I realized that inner voice was rushing the learning process. It didn’t let me &lt;strong&gt;enjoy daily progress&lt;/strong&gt; or &lt;strong&gt;celebrate each new concept&lt;/strong&gt;. It wanted too much, too fast. It was turning me from a &lt;strong&gt;perfectionist&lt;/strong&gt; into an imperfectionist. So I said &lt;strong&gt;STOP&lt;/strong&gt;❗&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;I’m on this path&lt;/strong&gt;, and it won’t take a year, or even two. &lt;strong&gt;It’s a lifelong journey&lt;/strong&gt;. A path where I’ll always have something &lt;strong&gt;to learn&lt;/strong&gt; and where curiosity will always &lt;strong&gt;be alive.&lt;/strong&gt; You have to be friends with your &lt;strong&gt;inner self&lt;/strong&gt; and show yourself that you trust yourself. &lt;strong&gt;Celebrate your progress, however small&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What challenges have I faced?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The right way for learning...
&lt;/h3&gt;

&lt;p&gt;I had set up a daily schedule: study &lt;strong&gt;at least&lt;/strong&gt; 3 hours a day.But often I was afraid to even start. &lt;strong&gt;Afraid&lt;/strong&gt; of running into something I didn’t know, afraid &lt;strong&gt;of bugs&lt;/strong&gt; in my code... So I started small just &lt;strong&gt;10 minutes&lt;/strong&gt; working on something I already knew. That helped me silence that &lt;strong&gt;inner fear&lt;/strong&gt;, and show myself that I do know things, that each day adds another &lt;strong&gt;piece to the puzzle.&lt;/strong&gt; To prove I’m not incapable or powerless. To overcome the fear of failure, because &lt;strong&gt;we learn&lt;/strong&gt; through mistakes and bugs.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Time management
&lt;/h3&gt;

&lt;p&gt;• Time used to &lt;strong&gt;scare me&lt;/strong&gt;❗I felt it &lt;strong&gt;slipping&lt;/strong&gt; by, &lt;strong&gt;pressuring me&lt;/strong&gt;. I wanted more, and I wanted it fast. I started thinking I was learning too slowly, doubting my schedule, thinking I was stuck. But that’s because I wasn’t &lt;strong&gt;looking back&lt;/strong&gt; at my progress.&lt;/p&gt;

&lt;p&gt;• At the small projects I had created. The more I learned, the more I &lt;strong&gt;wanted to build&lt;/strong&gt; amazing websites, but I didn’t want to spend time building, just learning.And that &lt;strong&gt;was wrong.&lt;/strong&gt; It’s like learning math formulas without applying them. Or learning a new language but never writing in it, only speaking.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Developers and online noise
&lt;/h3&gt;

&lt;p&gt;• I started learning from video tutorials. But soon, it became a &lt;strong&gt;storm&lt;/strong&gt; of videos, like a loop. I watched &lt;strong&gt;more and more&lt;/strong&gt;, hoping to learn more and more...But my eyes were tired, and without reviewing or applying anything, taking notes was almost &lt;strong&gt;pointless.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;• Then I stumbled upon &lt;strong&gt;all kinds of online ads&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;“You can build anything using just CSS and HTML...”,&lt;br&gt;
“Learn to code in 3 months...”,&lt;br&gt;
“Get hired in just a few months if you follow this course...”&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Those things started to discourage me&lt;/strong&gt;. I felt like I was moving &lt;strong&gt;too slowly.&lt;/strong&gt; I started doubting myself: &lt;strong&gt;“Maybe it’s not for me⁉️”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;But the truth is&lt;/strong&gt;, that’s not how real learning works. You &lt;strong&gt;can’t&lt;/strong&gt; become a real developer in one year and be perfect. Everyone learns at their own pace. You’re &lt;strong&gt;not a robot.&lt;/strong&gt; You &lt;strong&gt;can’t absorb&lt;/strong&gt; programming in a few weeks and suddenly be a developer❗&lt;/p&gt;




&lt;h2&gt;
  
  
  In conclusion❤️
&lt;/h2&gt;

&lt;p&gt;• &lt;strong&gt;It wasn’t easy in the beginning.&lt;/strong&gt; But I had to be &lt;strong&gt;consistent&lt;/strong&gt;. I had to prove to myself that I can, &lt;strong&gt;step by step.🥰&lt;/strong&gt; To learn from mistakes. To stop giving power to that inner voice. To become whole, strong. To learn &lt;strong&gt;from failures&lt;/strong&gt; and &lt;strong&gt;trust the process❗&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Work with yourself, not against yourself.&lt;/strong&gt;🥰&lt;br&gt;
Learn to &lt;strong&gt;enjoy the journey&lt;/strong&gt;, not just chase the destination.🤗&lt;br&gt;
As always, feel free to &lt;strong&gt;share your thoughts&lt;/strong&gt;, your feedback means &lt;strong&gt;a lot&lt;/strong&gt; to me. &lt;strong&gt;Thank you for reading&lt;/strong&gt;, see you around!🥰🤗&lt;/p&gt;




</description>
      <category>beginners</category>
      <category>programming</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Challenge yourself with CSS, JS, or React — my quiz game awaits!🎮</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Fri, 25 Jul 2025 14:39:49 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/challenge-yourself-with-css-js-or-react-my-quiz-game-awaits-3hhk</link>
      <guid>https://dev.to/cristea_theodora/challenge-yourself-with-css-js-or-react-my-quiz-game-awaits-3hhk</guid>
      <description>&lt;p&gt;Hey everyone!👋&lt;br&gt;
I know I haven’t posted in a while, I’ve been spending my time learning and building small projects. Today, I’m excited to share one of the little games I’ve created!&lt;br&gt;
It’s nothing too fancy, but ever since I started coding, I told myself that I wanted to create a fun quiz game, &lt;strong&gt;with sounds&lt;/strong&gt;, &lt;strong&gt;scoring&lt;/strong&gt;, and &lt;strong&gt;colorful&lt;/strong&gt; UI to make it engaging for players.&lt;br&gt;
I’d love for you to check it out, play around with it, and let me know what you think. Your feedback means a lot to me, especially since I’ve only been on this coding journey for &lt;strong&gt;about 10 months&lt;/strong&gt;. Knowing that someone appreciates my work would really make my day!❤️&lt;/p&gt;




&lt;h2&gt;
  
  
  What is this game?
&lt;/h2&gt;

&lt;p&gt;This is an interactive quiz game designed to help you improve your knowledge of CSS, React, and JavaScript.&lt;br&gt;
You can pick a category and try to answer as many questions correctly as you can.&lt;br&gt;
The game is built for both beginners who want to learn and developers who want to quickly test their knowledge.&lt;/p&gt;

&lt;p&gt;In short, this game is:&lt;br&gt;
 &lt;strong&gt;An educational quiz&lt;/strong&gt; –&amp;gt; a quick test for your web development knowledge.&lt;br&gt;
 &lt;strong&gt;An interactive learning tool&lt;/strong&gt; –&amp;gt; helping you spot where you need to improve.&lt;br&gt;
 &lt;strong&gt;A fun challenge&lt;/strong&gt; –&amp;gt; see how many correct answers you can get!&lt;/p&gt;




&lt;h2&gt;
  
  
  Gallery
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dark mode screenshot&lt;/th&gt;
&lt;th&gt;Light mode screenshot&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu92cmcrcvdh0rwhhn3qk.png" alt=" " width="500" height="412"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgzgd4s4y5jgoat8irzu.png" alt=" " width="500" height="413"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Correct answer&lt;/th&gt;
&lt;th&gt;Wrong answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3r4q6g996nfsgilop17z.png" alt=" " width="500" height="413"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flp5qyrj1tfmleley3xq6.png" alt=" " width="500" height="412"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




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

&lt;p&gt;Live game: &lt;a href="https://6883397c8e275d000883ab72--quiz-game11.netlify.app/" rel="noopener noreferrer"&gt;Play here!&lt;/a&gt;&lt;br&gt;
Source code: &lt;a href="https://github.com/Theodora-11/quiz-game" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What features does the game have?
&lt;/h2&gt;

&lt;p&gt;• Technologies: Pure HTML, CSS, and JavaScript (no frameworks).&lt;br&gt;
• Background sounds: Fun sound effects to make the experience more interactive.&lt;br&gt;
• Light/Dark theme: Switches between light and dark modes.It even detects your OS theme automatically.&lt;br&gt;
• Responsive design: Fully responsive, looking great on mobile, tablet, and desktop.&lt;br&gt;
• Life system: You have 3 chances.&lt;br&gt;
• Scoring system: Earn points for each correct answer and track your high score.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Journey ❤️
&lt;/h2&gt;

&lt;p&gt;Working on this project taught me so much more than just coding. I built everything from scratch with pure &lt;strong&gt;HTML&lt;/strong&gt;, &lt;strong&gt;CSS&lt;/strong&gt;, and &lt;strong&gt;JavaScript&lt;/strong&gt; – no frameworks, no shortcuts. It challenged me to truly understand the fundamentals and to think creatively about solving problems.&lt;/p&gt;

&lt;p&gt;One of the biggest lessons I learned is how important it is to create projects that &lt;strong&gt;make you happy&lt;/strong&gt;, projects that &lt;strong&gt;spark your curiosity&lt;/strong&gt; and keep you &lt;strong&gt;motivated&lt;/strong&gt;. I’ve always wanted to build a fun quiz game, and working on something I genuinely enjoy made every step exciting, even when things got tricky.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Through this project I learned:&lt;/strong&gt;&lt;br&gt;
• How to build responsive and interactive UI/UX without relying on external libraries.&lt;br&gt;
• The importance of small details: colors, transitions, sounds, and animations can make a big difference.&lt;br&gt;
• That building something you love will always push you to go further and learn more.&lt;/p&gt;

&lt;p&gt;This game isn’t just a coding exercise - it’s a reminder that programming can be fun and creative when you build something you care about.&lt;br&gt;
&lt;strong&gt;Leave a comment if you liked it, it would mean a lot to me!&lt;/strong&gt; 🤗&lt;/p&gt;




</description>
      <category>javascript</category>
      <category>programming</category>
      <category>discuss</category>
      <category>learning</category>
    </item>
    <item>
      <title>How I Got Started? Why We Shouldn't Give Up❗</title>
      <dc:creator> Theodora Cristea</dc:creator>
      <pubDate>Mon, 14 Jul 2025 16:48:50 +0000</pubDate>
      <link>https://dev.to/cristea_theodora/how-i-got-started-why-we-shouldnt-give-up-1dl3</link>
      <guid>https://dev.to/cristea_theodora/how-i-got-started-why-we-shouldnt-give-up-1dl3</guid>
      <description>&lt;p&gt;First of all, hello everyone, this is my first post in this community.&lt;br&gt;
&lt;strong&gt;“Hello world!”&lt;/strong&gt; I can’t wait to get to know you! Let me briefly introduce myself: my name is &lt;strong&gt;Theodora&lt;/strong&gt;, I’m 23 years old, and I’ve decided to start a journey down a completely new and &lt;strong&gt;parellel&lt;/strong&gt; path. Yes, you heard that right!🙃&lt;/p&gt;

&lt;p&gt;I felt like my life needed a new direction, something more challenging, something that constantly feeds my curiosity and helps me grow, without boring me with repetitive goals, something that pushes me and makes me want to come back to &lt;strong&gt;work&lt;/strong&gt; with joy.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Why Did I Choose Web Development?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Someone special to me encouraged me to dive into the world of web development. I called it a “parallel” world earlier because that’s exactly how it felt I had absolutely no idea what web development even was. It all seemed impossible at first! But I chose to do it because it felt like a &lt;strong&gt;real challenge&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I love that this world is open to anyone regardless of age, background, or degree. All you really need is &lt;strong&gt;curiosity&lt;/strong&gt;, &lt;strong&gt;persistence&lt;/strong&gt;, and the will to learn, to be a bit of a perfectionist, and to never give up.&lt;br&gt;
  As I got deeper into it, I realized that this is a space where ideas take shape, where code becomes the bridge between imagination and reality.It’s a universe where a few lines of HTML can turn a blank page into an experience, where CSS adds personality, and JavaScript breathes life into your vision.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Because web development is about building, failing, learning, and trying again and every time, I found myself growing through it. I wasn’t just learning how to build websites or apps, I was learning how to &lt;strong&gt;solve problems&lt;/strong&gt;, how to &lt;strong&gt;think logically&lt;/strong&gt;, and how to &lt;strong&gt;create something&lt;/strong&gt; others could use, appreciate, and even be inspired by.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What Did I Feel When I Wrote My First Lines of Code?
&lt;/h2&gt;

&lt;p&gt;Honestly, I was thrilled! My very first project was a small &lt;strong&gt;quiz game&lt;/strong&gt;.  Nothing huge but that’s not what matters. What matters is the joy of seeing your idea live in the browser. Of knowing that you built something from scratch, maybe with 100 lines of code and it actually works!&lt;br&gt;
   I swear, anyone who’s started coding knows the excitement of their first &lt;code&gt;alert()&lt;/code&gt; or &lt;code&gt;console.log()&lt;/code&gt;...🙃&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Didn’t it feel like getting your favorite candy as a kid?&lt;/strong&gt; 🙃&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Let’s celebrate those little victories that made your journey so worth it leave a comment and share yours!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What Are My Plans?
&lt;/h2&gt;

&lt;p&gt;Right now, my goal is to keep going and to enjoy every level I unlock along this path. I know it won’t always be easy and that’s okay. I’ll continue anyway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;p&gt;Because I’ve become &lt;strong&gt;friends&lt;/strong&gt; with web development. I crave &lt;strong&gt;challenges&lt;/strong&gt;, &lt;strong&gt;knowledge&lt;/strong&gt;, and &lt;strong&gt;creativity&lt;/strong&gt; and that’s exactly what this field gives me. If I could give my past self (or you, reading this) a piece of advice, it would be this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do what makes you happy. Without regret, without hesitation, and without fear. Nobody is born knowing everything not in this field, not in any field.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And even if you’re starting from zero, that doesn’t mean you’re incapable or weak. We are made to &lt;strong&gt;grow&lt;/strong&gt;, to &lt;strong&gt;absorb knowledge&lt;/strong&gt;, and to &lt;strong&gt;expand&lt;/strong&gt;. Believe in yourself in your goals and your choices.&lt;/p&gt;




&lt;h2&gt;
  
  
  Will I Ever Regret It?
&lt;/h2&gt;

&lt;p&gt;I know that web development is not easy. No one is born perfect. We’re born to learn. We’re wired to seek, to explore, to stand in awe of the unknown. That deep hunger for knowledge never really fades and that’s what makes us extraordinary. Yes, we’ll make mistakes. But &lt;strong&gt;mistakes aren’t the enemy&lt;/strong&gt; fear of trying is. Every wrong turn teaches us something. Every fall becomes a lesson. 🙃&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Confidence isn’t something we’re born with it’s something we build, slowly, every time we choose to rise again and try once more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;True growth doesn’t mean never failing it means becoming better than we were yesterday.I understand that there are numerous concepts to master but I encourage you to &lt;strong&gt;be patient&lt;/strong&gt; and &lt;strong&gt;persist in your efforts&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;So, will I ever regret choosing this path? Is it really impossible⁉️&lt;br&gt;
&lt;strong&gt;Absolutely not.❌ And neither will you.&lt;/strong&gt;&lt;br&gt;
Because we are strong, not because we never fall, but because we keep getting back up. Our strength lies in the courage to move forward, even when it’s hard. We don’t need to have all the answers we just need the will to keep looking.&lt;br&gt;
That’s what makes us powerful: We don’t stop.&lt;br&gt;
&lt;strong&gt;Keep going!👌&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>discuss</category>
      <category>learning</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
