Day 9 – Node.js Using fs.promises Node.js provides a Promise-based version of the fs module that works seamlessly with async/await. Instead of callback-based APIs, we can use: require('fs').promises This improves readability, structure, and production-level code quality. Next: Understanding path module in Node.js. #NodeJS #BackendDevelopment #JavaScript #AsyncAwait #SoftwareEngineering
Node.js fs Promises with async/await
More Relevant Posts
-
🚀 One of the reasons Node.js is so powerful is its event loop. Instead of creating a new thread for every request, Node.js uses a non-blocking event loop to handle thousands of operations efficiently. This is why Node.js performs so well for APIs and real-time applications. Understanding how the event loop works can help you write more efficient backend code. I made a quick breakdown in this carousel 👇 Did the event loop confuse you when you first learned Node.js? #nodejs #backend #javascript #webdevelopment
To view or add a comment, sign in
-
React 19 makes refs simple One of the most awkward React APIs is finally cleaned up. Earlier, passing refs meant: - forwardRef boilerplate - TypeScript generic issues - Extra wrapper components import { forwardRef } from "react"; const Input = forwardRef(function Input(props, ref) { return <input ref={ref} {...props} />; }); With React 19, ref is just a regular prop. function Input({ ref, ...props }) { return <input ref={ref} {...props} /> } - No forwardRef - No HOC - Just clean, predictable React A small change that significantly improves developer experience, especially for reusable component libraries in React. #React19 #FrontendEngineering #JavaScript #TypeScript #DeveloperExperience
To view or add a comment, sign in
-
Most Node.js developers still use Express.js. But benchmarks show Fastify can be up to 2x faster. So the real question is: Why are so many developers still choosing Express over Fastify? Here is a quick comparison 👇 Some key differences: ⚡ Fastify • 30-50% faster performance • Lower memory usage • Built-in schema validation • Better for high performance APIs 🚀 Express • Simpler ecosystem • Huge community • Tons of middleware Both are great tools. But for performance-heavy APIs, Fastify is becoming a strong alternative. What are you using in production right now? Express.js or Fastify.js and why? #nodejs #javascript #backenddevelopment #webdevelopment
To view or add a comment, sign in
-
-
JavaScript Module Formats — Why So Many? Ever opened a package and wondered why there are so many build files? index.ts index.js index.cjs index.mjs index.es.js index.umd.js It’s not duplication — it’s compatibility. Each file exists to support a different environment: 🔹 TypeScript for development 🔹 CommonJS for traditional Node.js 🔹 ES Modules for modern bundlers and tree-shaking 🔹 UMD for universal browser + Node usage When building libraries, understanding these formats helps you: - Avoid import/export errors - Support multiple environments - Improve performance with proper tree-shaking - Publish cleaner, production-ready packages Sometimes, growth as a developer isn’t about learning a new framework — it’s about understanding the fundamentals better. What module format do you default to in your projects? #JavaScript #TypeScript #NodeJS #Frontend #Backend #SoftwareEngineering #DevTips
To view or add a comment, sign in
-
-
Day 14 – Node.js Handling POST Request Body Today I implemented request body handling using pure Node.js. Since request data comes as a stream, we must manually collect chunks using req.on('data') and process them in req.on('end'). Understanding this helps build a strong foundation before using frameworks like Express. Next: Introduction to Express.js 🚀 #NodeJS #BackendDevelopment #JavaScript #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 SSR with Next.js API Routes (JavaScript) Next.js API routes allow you to create serverless functions that can be used for data fetching and other server-side logic. These API routes can be called from `getServerSideProps` to retrieve data and pass it to your components. This approach provides a clean and organized way to handle server-side operations within your Next.js application. #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
🚀 What I Learned Today: Node.js Internals • Node.js runs JavaScript on a single main thread • Top-level code executes first before the event loop starts • Import statements load during initialization • Event Loop manages asynchronous operations Event Loop Phases: • Timers → setTimeout() / setInterval() • I/O Polling → file system & network operations • Check → setImmediate() (Node.js specific) • Close Callbacks → cleanup tasks • Node.js uses a libuv worker thread pool (default: 4 threads) • Thread pool size can be changed using process.env.UV_THREADPOOL_SIZE https://lnkd.in/gwFG5WVW thank you Piyush Garg sir Hitesh Choudhary sir Akash Kadlag sir #chaiaurcode #NodeJS #JavaScript #Backend #EventLoop
To view or add a comment, sign in
-
-
Most React developers use this pattern every day: setCount(prev => prev + 1) But very few can clearly explain why it’s necessary. In React, state updates are not immediate. They can be batched and executed later, which means the value you’re using (count) might already be outdated when the update actually runs. The functional update avoids this problem. Instead of relying on a potentially stale value, it receives the latest state at the exact moment React processes the update. So instead of saying: “set the value to this” you’re saying: “update based on whatever the current value is” That’s the key difference. This pattern isn’t just syntax, it’s how you avoid subtle bugs when your next state depends on the previous one. #React #JavaScript #Frontend #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
Optimizing a Node.js API isn’t just about writing code — it’s about writing efficient, scalable, and production-ready systems. Here are 14 practical tips to improve Node.js API performance — from async handling to caching, profiling, HTTP/2, and PM2 clustering. Performance is not a feature. It’s a responsibility. What techniques do you use to optimize your APIs? #NodeJS #BackendDevelopment #API #WebDevelopment #JavaScript #PerformanceOptimization #SoftwareEngineering #TechTips
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