I removed Express from my Node.js project. Then removed the http module too. Built everything from raw TCP and finally understood what was actually happening. Three things that clicked: → request.body is a stream, not a property Node reads your request in chunks. That’s why even very large uploads don’t crash your server. → GET, POST, and PUT are not interchangeable Send the same POST twice, two records get created. Send PUT twice, nothing changes. That difference has a name: idempotency. → Postman is just a GUI Every button maps to three things: method, headers, and body. Wrote a 4-part breakdown. #NodeJS #JavaScript #BackendDevelopment #medium Read the full article here: https://lnkd.in/dWQRp7Ta
Ditching Express and http in Node.js
More Relevant Posts
-
Count the lines of React 18 code you write for every single form submission: const [isPending, setIsPending] = useState(false) const [error, setError] = useState(null) async function handleSubmit(e) { e.preventDefault() setIsPending(true) try { await save() } catch(e) { setError(e.message) } finally { setIsPending(false) } } Now count the React 19 version: const [state, formAction, isPending] = useActionState(saveAction, null) One line. Same behavior. Automatic pending state, error handling, and reset. That's what React 19 is: the same React, with the boilerplate removed. Here's everything that changed: ⚡ Actions + useActionState — async mutations without manual loading state 🌐 Server Actions — call server functions from client components. No custom API routes. Just 'use server'. 🪜 Server Components — render on server, ship zero JS. Default in Next.js 15. ❤️🔥 useOptimistic — instant UI updates before the server responds. Auto-rollback on failure. ⚙️ use() hook — unwrap promises and read context inside loops, conditions, early returns. 🏠 Native metadata — <title> and <meta> tags from any component. No react-helmet. ❌ No more forwardRef — ref is just a prop in React 19. forwardRef deprecated. 🔍 Better hydration errors — actual diffs instead of "tree will be regenerated". 🤖 React Compiler — automatic memoization at build time. No more useMemo busywork. I wrote the complete guide — every new API with real before/after examples, Server Actions deep dive, and the React 18 → 19 migration steps. Still on React 18? 👇 #React #JavaScript #Frontend #WebDev #ReactJS #100DaysOfBlogging
To view or add a comment, sign in
-
Everyone explains what happens when you type a URL. DNS. TCP handshake. HTTP request. We've all seen that. Nobody talks about what happens AFTER it hits your server. Here's the full internal journey of a single register request inside a production Node.js backend 👆 7 layers. Each with exactly one job. The part most tutorials skip — Your controller should never touch the database. Your service should never know HTTP exists. Your repository should be the ONLY file that knows which ORM or database you're using. Break any of these rules and you'll feel it the moment you try to write a unit test or swap a dependency. This pattern is called Layered Architecture. #NodeJS #ExpressJS #BackendDevelopment #TypeScript #SystemDesign #JavaScript #WebDevelopment #SoftwareEngineering #LearningInPublic #CleanCode
To view or add a comment, sign in
-
-
🚨 Stop installing 15 packages just to start a Node.js API. I've built APIs with Express for years. It's battle-tested, flexible, and has a massive ecosystem. But here's the problem nobody talks about: Every new project starts the same way: → npm install cors helmet jsonwebtoken bcrypt swagger-ui-express... → Manually wiring app.use(require('./routes/users')) for every route → Bolting TypeScript on like an afterthought → Copy-pasting the same security middleware config (again) Sound familiar? That frustration is exactly why I built mimi.js — a production-ready Node.js framework that keeps Express's familiar API but ships with everything you actually need: ✅ Built-in JWT auth + bcrypt password hashing ✅ Auto route loading — just drop files into routes/ ✅ Auto Swagger docs from JSDoc comments ✅ Database adapters for MongoDB & SQLite ✅ Security headers, CORS, request logging — all built-in ✅ TypeScript-first, zero build step The goal wasn't to replace Express. It was to build the version of Express I wished existed when starting a new project. No 15-package install. No manual wiring. Just code. Over the next 6 days, I'll deep-dive into how it works — the routing engine, performance numbers, built-in features, and real-world use cases. 👇 Have you felt this pain too? Drop a comment — I'd love to hear your experience. 🔗 https://lnkd.in/gypGM-Y4 📦 npm install mimi.js #nodejs #javascript #typescript #webdevelopment #backend #expressjs #opensource #developer #programming #coding #softwareengineering #mimijs
To view or add a comment, sign in
-
-
What if I told you that there's a way to significantly improve the performance of your NestJS applications by leveraging a technique called "caching"? Essentially, caching involves storing frequently accessed data in a temporary storage location, so that when the same data is requested again, it can be retrieved quickly from the cache instead of being re-computed or re-fetched from a database. For example, let's say you have an API endpoint that retrieves a list of users from a database. ```javascript // users.service.ts import { Injectable } from '@nestjs/common'; @Injectable() export class UsersService { async getUsers(): Promise<any[]> { // simulate a database query return [ { id: 1, name: 'John Doe' }, { id: 2, name: 'Jane Doe' }, ]; } } ``` By caching the result of this endpoint, you can avoid hitting the database on subsequent requests and improve the overall response time of your application. What caching strategies are you using in your applications to improve performance? 💬 Have questions or working on something similar? DM me — happy to help. #NestJS #NodeJS #Caching #PerformanceOptimization #BackendDevelopment #APIPerformance #SoftwareEngineering #CodingBestPractices #TechnicalDebt
To view or add a comment, sign in
-
Why my API was slow (and what actually fixed it) I recently noticed one of my APIs was taking way too long to respond — sometimes 3–4 seconds per request. At first, I thought it was just my code being “messy,” but digging deeper taught me a lot. Here’s what I found: Too many unnecessary DB calls – I was fetching the same data multiple times instead of reusing it. Unoptimized queries – Some queries were scanning entire collections instead of using indexes. Synchronous loops – I was waiting for each call to finish one by one, instead of running them in parallel. After making a few changes: Added proper indexes Used Promise.all for parallel DB calls Cached repeated data where possible Response time went from 3–4 seconds → under 300ms. The biggest takeaway? Sometimes it’s not your code logic, it’s how your code talks to the database and handles tasks. Small adjustments can make a huge difference. #FullStackDeveloper #WebDevelopment #APIDevelopment #BackendDevelopment #NestJS #NextJS #JavaScript #PerformanceOptimization #SoftwareDevelopment
To view or add a comment, sign in
-
-
Node.js vs. Go HTTP Server 🌐 Leaving Node.js behind: Building a raw HTTP server in Go 🚀💻 After spending the week locking down my PostgreSQL database, it is finally time to build the API server. But moving from Node.js to Go requires a complete mental reset. In Node, you reach for Express.js immediately. You write app.get("/", (req, res) => {}) and you're good to go. In Go? There is no Express. You build it raw using the standard library (net/http). And Go completely flips the script on how you handle data. In Node, it’s always (req, res) — Request first, Response second. In Go, the handler looks like this: func handler(w http.ResponseWriter, r *http.Request) Response first, Request second. Why? Because Go treats the ResponseWriter as a literal tool you are handed to execute your job. The server says: "Here is your pen (w). Now look at the paperwork (r) and write your response back immediately." I'm officially writing my first route to start the Auth sequence (Signup/Login). It’s raw, it’s fast, and there’s no framework magic hiding the fundamentals from me. We move! 💪🏾 To my devs who made the switch from JavaScript/Node.js to Go: What was the hardest habit you had to break? Let’s gist in the comments 👇🏾 #Golang #NodeJS #BackendEngineering #API #SoftwareDevelopment #TechBro #TechInNigeria #WeMove
To view or add a comment, sign in
-
-
⚡ Caching Service Registry 📈 Smart Routing Concept (Node.js + React Example⏩) 🧠 Calling service registry on every request comes with set of problems: 1. Slower APIs 2. Registry overload 3. Unnecessary network hops Solution includes - 1. Cache service instances locally in your API Gateway (Node.js) 2. React just calls the gateway (no direct registry calls) Flow - Refer the image for example. 🔥 Advanced Patterns 📡 1. Watch-Based Updates Consul supports real-time updates No polling needed ⚖️ 2. Smart Load Balancing Use: Round Robin Weighted routing Health-aware routing 💥 3. Fail-Safe Mode JavaScript Code- try { return await cache.getService("product-service"); } catch (err) { console.log("Registry down, using stale cache..."); return cache.cache["product-service"] || []; } Takeaway - Modern systems (like service mesh with Envoy Proxy) implement- ✔ Cache service discovery ✔ Continuously sync ✔ Combine with health check Registry should be queried occasionally, not per request. #Node #React #JavaScript #Microservices #Software #Caching #Speed #ScalableSystems #Engineering #Learning #Technical #Careers
To view or add a comment, sign in
-
-
Spent 3 hours last week debugging a Node.js API that was timing out under load. It was doing 7 things wrong at once. And I've seen the same 7 things in almost every backend I've audited. Here they are in case yours is quietly suffering too. 1. Blocking the event loop Someone wrote a synchronous file parser inside a route handler. Every request waits for it. All of them. Simultaneously. Node is single-threaded by design which means CPU-heavy work on the main thread freezes everything else. worker_threads exist for this. Use them. 2. New DB connection per request Fine when 3 people use your API. When 300 hit it simultaneously, your database runs out of connections and starts refusing them. pg-pool or mysql2's built-in pool. 10 minutes to set up. Completely worth it. 3. The N+1 problem You fetch 50 users, then loop through and fetch each profile individually. That's 51 queries where 1 would do. Under light traffic nobody notices. Under real load, your DB is on fire. Eager loading or a JOIN. Pick one. 4. No caching I've seen APIs hit the database for dropdown data that changes once a month on every single request. Redis with a sensible TTL eliminates 60–70% of those calls instantly. Some endpoints don't need it. But some of yours do and you probably haven't checked. 5. No gzip compression app.use(require('compression')()) One line. Responses shrink 60–70%. I genuinely don't know why this isn't on by default. 6. Unhandled promise rejections No error. No log. Just a process that crashes at 2am and nobody knows why until a customer complains. Global unhandledRejection handler. Not optional in production. 7. Running on one CPU core Your server has 8 cores. Node uses 1 by default. PM2 cluster mode. One command. Took me longer to type this than to actually set it up. None of these need a rewrite or a new framework. They just slip through when nobody's specifically looking for them. Check these before assuming you need bigger servers. Which one are you guilty of? #NodeJS #JavaScript #BackendDevelopment #API #WebDevelopment #Programming #SoftwareEngineering #Angular
To view or add a comment, sign in
-
my Mini Product Studio Backend Challenge! I built a production-ready REST API for a lightweight task management system using: 🛠️ Tech Stack: * Node.js + Express + TypeScript * Prisma ORM (SQLite) * Zod for validation * Redis (caching) * Socket.io (real-time updates) * Railway (deployment) 💡 Key Features: >> Paginated, filterable & sortable task listing (handled at DB level) >> Full task lifecycle (create, update, archive) >> Activity logging system (auto-tracks changes like status, priority, assignments) >> Comments system per task >> Clean layered architecture (routes → controllers → services → repositories) >> Input validation with detailed error handling (Zod) >> Caching layer with proper invalidation >> Real-time updates using WebSockets >> Rate limiting for API protection 📊 API Design Highlights: >> Consistent response structure (data / meta / error) >> Efficient queries (no N+1 problem) >> Proper HTTP semantics & status codes >> Pagination with total count & metadata 🌐 Live Demo & Docs: >> Swagger Docs: https://lnkd.in/dksckGcQ >> Tasks Endpoint: https://lnkd.in/d7jW_p2m >> WebSocket Test: https://lnkd.in/dcGBkMKh >>github: https://lnkd.in/dGp5WZC8 🧠 What I focused on: Building something close to real production standards — not just “it works”, but clean architecture, scalability, and maintainability. 📌 Would love to hear your feedback! #NodeJS #Express.js #BackendDevelopment #TypeScript #RESTAPI #Prisma #Redis #WebSockets #SoftwareEngineering
To view or add a comment, sign in
-
🚀 DAY 5 OF BACKEND DEVELOPMENT Back from Easter break and straight into action 💻🔥 Today we leveled up with: ✨ Middlewares ✨ MVC architecture ✨ How routes & controllers work together On our project, we went deeper into using fs as a database: 📁 Storing registered users in a file 📁 Reading user data 📁 Deleting users using their ID Also learned: 🆔 UUID (for unique user IDs) 🧪 Postman (testing our APIs) It’s getting more real every day… building actual backend logic now 💡 Consistency is the goal 💪🔥 #BackendDevelopment #NodeJS #ExpressJS #100DaysOfCode #BuildInPublic #TechJourney #CodingLife
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