💻 Day 25 of my Backend Journey Today I learned about Multer, the middleware that handles file uploads in Node.js with Express. At first, I didn’t realize why regular req.body couldn’t handle files — turns out, forms with file inputs use a different encoding (multipart/form-data), and Express alone can’t parse that. That’s where Multer comes in. It intercepts the request, extracts the file, and stores it (either in memory or on disk). After that, your app can use it like any other data — for example, saving image URLs in MongoDB. 🧩 Simple flow: HTML Form → Express → Multer → Uploaded File ✅ It’s one of those small but powerful tools that make backend development actually click. #100DaysOfCode #Nodejs #BackendDevelopment #Expressjs #Multer #LearningInPublic #WebDevelopment
Learned Multer for file uploads in Node.js with Express
More Relevant Posts
-
🚀 Connecting Databases the Right Way in Next.js! 🧠💻 Today, I watched another super insightful video by Sir Hitesh Choudhary on his "Chai or Code" YouTube channel — this one focused on how to connect databases in Next.js efficiently and safely. ☕ What I really loved about this video is that my mentor didn’t just show how to connect a database — he explained what to be careful about while doing it, especially when working with Next.js edge runtimes. ⚡ 🔥 Key Takeaways from the Video: ✅ Learned how to establish a proper database connection in a Next.js environment. ✅ Understood why Next.js runs on Edge Runtime and how it affects backend operations. ✅ Realized the importance of adding connection checks — making sure the database isn’t reconnected unnecessarily on every request. ✅ Learned how to handle environmental constraints that come with serverless and edge-based architecture. ✅ Gained a better understanding of writing clean, production-grade DB connection logic in modern web apps. 💡 This video was a perfect blend of theory + real-world development insights — especially around Next.js edge runtimes and database optimization. A huge thanks to Sir Hitesh Choudhary for explaining such a technical concept in an easy, developer-friendly way! 🙌 If you’re diving into Next.js backend development, this video is a must-watch to understand how to connect your DB the right way in an Edge Runtime environment! ⚡ #NextJS #DatabaseConnection #EdgeRuntime #BackendDevelopment #FullStackDevelopment #WebDevelopment #MERNStack #NextJSBackend #MongoDB #NodeJS #Serverless #SoftwareEngineering #ChaiOrCode #HiteshChaudhary #LearnToCode #CodingJourney #TechCommunity
How to connect Database in NextJS
https://www.youtube.com/
To view or add a comment, sign in
-
We just reduced a client's API response time from 2.3s to 180ms. 🚀 Here's the thing most developers miss: Your database queries aren't the bottleneck it's how you're handling them. Instead of optimizing SQL for hours, We added a simple Redis layer with a 5 minute TTL for frequently accessed data. One afternoon of work. 92% faster responses. The real lesson? We're so obsessed with learning the latest framework that we forget the fundamentals: Caching strategies Connection pooling Lazy loading Response compression While everyone's rewriting their apps in the newest framework, Some people here winning projects by actually solving performance problems. #NodeJS #WebDevelopment #FullStack #PerformanceOptimization #SystemDesign #JavaScript #SoftwareEngineering
To view or add a comment, sign in
-
-
Understanding .𝗲𝗻𝘃 Files and Their 𝗣𝗿𝗶𝗼𝗿𝗶𝘁𝘆 𝗪𝗵𝗮𝘁’𝘀 𝗮 .𝗲𝗻𝘃 𝗳𝗶𝗹𝗲? ↳ A .env file is where we store configuration values, like: DATABASE_URL=... API_KEY=... 𝗪𝗵𝘆 𝗺𝘂𝗹𝘁𝗶𝗽𝗹𝗲 .𝗲𝗻𝘃 𝗳𝗶𝗹𝗲𝘀? ↳ Different environments need different configurations. We don’t want to use our production API key in development and vice versa. That’s why frameworks allow multiple .env files like: .env .env.local .env.development .env.staging .env.production .env.<environment>.local 𝗟𝗼𝗮𝗱 𝗽𝗿𝗶𝗼𝗿𝗶𝘁𝘆 (𝗹𝗼𝘄𝗲𝘀𝘁 → 𝗵𝗶𝗴𝗵𝗲𝘀𝘁) 1 .env ├── 2 .env.local ├── 3 .env.<environment> └── 4 .env.<environment>.local .𝗲𝗻𝘃 vs .𝗲𝗻𝘃.𝗹𝗼𝗰𝗮𝗹 ↳ .env is the base config that is shared between all environments. ex: PORT=3000 ↳ .env.local is your personal overrides, it's meant only for your local machine. And it overrides values from .env. ex: PORT=5000 𝗕𝘂𝗶𝗹𝗱-𝘁𝗶𝗺𝗲 𝘃𝘀 𝗥𝘂𝗻-𝘁𝗶𝗺𝗲 𝗩𝗮𝗿𝗶𝗮𝗯𝗹𝗲𝘀 ↳ 𝗕𝘂𝗶𝗹𝗱-𝘁𝗶𝗺𝗲: Loaded when you build the app (e.g., React, Next.js). → Changing them needs a rebuild. → ex: NEXT_PUBLIC_API_URL=https://api.example.com ↳ 𝗥𝘂𝗻-𝘁𝗶𝗺𝗲: Loaded when the app starts (e.g., Node.js backend). → You can change them without rebuilding, just restart. → ex: DATABASE_URL=mysql://user:pass@host/db NOW YOU ARE .𝗲𝗻𝘃 MASTER 🕺
To view or add a comment, sign in
-
-
I built a small but powerful date-range feature on CeFinan.com to stop unfair comparisons between stocks. One day I tried to compare a 10‑year chart to a stock that only listed last year. The result looked meaningful but it wasn’t. So I built two simple options: - Max (adjusted): When you select >=2 instruments, I find the one with the shortest history (the newest listing) and align every other series to that start date. Result: every line covers the same period, no hidden look‑ahead, no misleading returns. - Custom (calendar): Pick any contiguous range inside the last 2 years (from 2 days to months). A calendar UI validates selection client‑side and the backend enforces the 2‑year limit. How I built it: - Frontend: Next.js + React (app router) + Tailwind, calendar picker with client validation. - Backend: Next.js API routes, Node.js, MySQL (mysql2/promise). Endpoint queries each ticker’s earliest available date, returns the aligned start date for chart queries.
To view or add a comment, sign in
-
-
⚡ Backend Devs: Build APIs Faster with devkit-cli Generate FastAPI or Express APIs with CORS, JWT authentication, and support for SQLite, PostgreSQL, MySQL, or MongoDB—all in one command. devkit create --backend-only ✅ Production-ready structure ✅ Containerized with Docker/Podman ✅ Auto-configured .env files Try it: https://lnkd.in/ez7_DJ5M #DevkitCLI #BackendDevelopment #FastAPI #ExpressJS #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Today I dived into APIs & HTTP methods in Node.js! APIs 🌐 are like bridges between apps and servers, letting them communicate seamlessly. I explored how HTTP methods define the actions we can perform: GET 📄 – fetch data POST ✉️ – create new data PUT 🔄 – replace data PATCH 📝 – update partially DELETE ❌ – remove data 💻 Mini-Project: User Management API with Node.js & Postman I built a User Management API that allows you to create, read, update, and delete user data using the HTTP methods above. This project helped me understand how APIs facilitate communication between the frontend and backend, and how servers efficiently handle requests. 🌐 Excited to continue applying this knowledge in mini-projects 🛠️ as I progress on my MERN Stack journey 💻✨ #NodeJS #API #WebDevelopment #MERNStack #LearningByDoing #CodingJourney #Postman
To view or add a comment, sign in
-
💡 Django Tip: Avoid the N+1 Query Problem One of the most common mistakes in Django ORM is forgetting to optimize related object queries. This leads to the N+1 query problem — one query to fetch your main objects, and then one additional query per related object. The result: 1. Multiple unnecessary database hits 2. Slow response times 3. Poor scalability The fix: 1. Use select_related and prefetch_related to fetch related data efficiently. Why? 1. Reduces database load drastically 2. Improves performance & user experience 3. Makes your app scale gracefully 4. Keeps your code clean & Django-idiomatic A small change in how you query can save your app from major performance bottlenecks. Copied from Ammar Munir
To view or add a comment, sign in
-
-
🗄️ Backend Journey – Part 5: Node.js with SQL After mastering REST APIs, I moved on to connecting Node.js with SQL to handle real database operations. Here’s what I explored in this part: • Faker.js → Generating fake data for testing (@faker-js/faker & older version faker@5.5.3) • MySQL2 package → Connecting Node.js with MySQL (npm i mysql2) • Running SQL commands from CLI and using schema.sql to initialize the database • Creating and managing routes to handle data dynamically: GET / → Show total number of users in the database GET /user → Display all users with email, ID, and username POST /user → Add a new user PATCH /user/:id → Edit a user’s username DELETE /user/:id → Delete a user It’s amazing to see how Node.js interacts with a real database and how data flows between the server and the client. Next, I’ll be working on advanced queries, joins, and integrating SQL with frontend templates to build a full-fledged web app 🚀 #Nodejs #MySQL #SQL #BackendDevelopment #Expressjs #Fakerjs #FullStack #WebDevelopment #CRUD #CodingJourney #Learning
To view or add a comment, sign in
-
Node.js Streams Explained What Moving the Pyramids Can Teach You About Node.js Streams 🏛️ Imagine you have a 3GB file that you need to upload/download using your Node.js server. How do you solve this task? Your first instinct as a Node.js developer might be to use an npm package. Sounds great to me! But what if I told you that while you're treating the file, you also need to add some business logic? Let's say, for example, the file is a CSV, and you need to keep certain lines and ignore others—while saving the ignored lines in a separate file. Can your npm package handle that? Probably. Is it easier, simpler, scalable? Probably yes. But now you need another package and more complex code in your codebase, which might affect performance. Now let's take a step back. Before downloading the package, did you ask yourself what technique the creators of these packages use under the hood? I'll answer that for you—it's most likely streams, and that's what we're going to talk about in this post. So buckle up, and let https://lnkd.in/gRjYzC_z
To view or add a comment, sign in
-
Node.js Streams Explained What Moving the Pyramids Can Teach You About Node.js Streams 🏛️ Imagine you have a 3GB file that you need to upload/download using your Node.js server. How do you solve this task? Your first instinct as a Node.js developer might be to use an npm package. Sounds great to me! But what if I told you that while you're treating the file, you also need to add some business logic? Let's say, for example, the file is a CSV, and you need to keep certain lines and ignore others—while saving the ignored lines in a separate file. Can your npm package handle that? Probably. Is it easier, simpler, scalable? Probably yes. But now you need another package and more complex code in your codebase, which might affect performance. Now let's take a step back. Before downloading the package, did you ask yourself what technique the creators of these packages use under the hood? I'll answer that for you—it's most likely streams, and that's what we're going to talk about in this post. So buckle up, and let https://lnkd.in/gRjYzC_z
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development