[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-692304-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-692304-en":130,"doc-similar-692304":166},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","nodejs-handbook","Node.js Handbook","","Node.js Handbook provides an introductory, practical overview of the Node.js server-side JavaScript runtime, explaining why it is widely used and how it operates beyond the browser. It covers core setup and execution workflows, command-line usage, environment variables, security and maintenance considerations, and package management best practices. The guide also introduces essential Node capabilities such as arguments, ES modules, event-driven architecture, file and path handling, streams, async/await patterns, HTTP server/request handling, and the Node event loop.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/nodejs-handbook/692304/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/nodejs-handbook/692304.png","ImageObject",300,407,{"name":42,"@type":43},"（）","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-29","2026-11-09",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",6,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What problem does Node.js solve compared with running JavaScript in the browser?","Question",{"text":63,"@type":64},"Node.js runs the V8 JavaScript engine outside the browser, enabling server-side development with high performance. It uses asynchronous I/O primitives so operations resume when responses return instead of blocking threads.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How does Node.js handle many concurrent connections efficiently?",{"text":68,"@type":64},"Node.js can handle thousands of concurrent connections with a single server by avoiding per-request thread management. This reduces complexity and the bug risks associated with thread concurrency.",{"name":70,"@type":61,"acceptedAnswer":71},"What is covered in the handbook regarding package management and security?",{"text":72,"@type":64},"The handbook explains modern package installation practices, security and maintenance considerations, and package.json best practices. It also discusses environment configuration and security considerations for safe operation.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},692304,1794192930,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,101,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":97,"doc_module":4,"doc_module_name":25,"category_name":98,"show_sort_weight":99,"slug":100},5,"Comic",60,"comic",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":97,"slug":129},19,"General","general",{"code":4,"msg":82,"data":131},{"doc_id":79,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":55,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":80,"read_time":144,"preview_page_count":97,"preview_urls":145},5909898202386,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Node.js Handbook  \nFlavio Copes  \nUpdated July 31, 2026  \nContents  \nPreface 3  \nLegal 3  \nIntroduction to Node.js 3  \nAn example Node.js application 4  \nHow to install Node.js 5  \nDifferences between Node and the Browser 5  \nRun Node.js scripts from the command line 5  \nRestart the application automatically 6  \nEnvironment Variables 6  \nBasic Environment Variable Usage .................................... 6  \nSecurity Considerations .......................................... 7  \nGetting arguments from the command line 8  \nModern Package Management 9  \nPackage Installation Best Practices .................................... 9  \nSecurity and Maintenance ......................................... 9  \nPackage.json Best Practices ........................................ 9  \nOutput to the command line 10  \nAccept input from the command line 10  \nUsing the readline module ......................................... 11  \nUsing ES Modules in Node.js ....................................... 11  \nThe Node Event emitter 11  \nFile information 12  \nFile paths 14  \nWorking with paths ............................................ 14  \nReading files 14  \nWriting files 15  \nAppend to a file .............................................. 15  \nUsing streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16  \nWorking with folders 16  \nThe Node fs module 19  \nError Handling Best Practices ....................................... 21  \nThe Node events module 21  \nThe Node [http module](http module) 22  \nNode.js Streams 23  \nEnvironment Configuration 25  \nError handling 26  \nModern Async Pattern with async/await ................................. 27  \nBuild an [HTTP](HTTP) Server 28  \nMaking [HTTP requests](HTTP requests) 29  \nGet [HTTP request](HTTP request) body data ....................................... 31  \nThe Node.js Event Loop 32  \nUnderstanding process.nextTick() ..................................... 43  \nUnderstanding setImmediate() ...................................... 43  \nDiscover JavaScript Timers 44  \nModern Node.js Development Features 47  \nWatch Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47  \nBuilt-in Task Runner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47  \nTesting with Node.js Built-in Test Runner 47  \nBasic Test Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47  \nRunning Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48  \nTest Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48  \nPreface  \nThis book aims to be an introduction to Node.js, the most popular server-side JavaScript runtime.  \nIf you’re unfamiliar with JavaScript, before reading this book I highly recommend reading the JavaScript Handbook and the TypeScript Handbook.  \nThis book was originally published in 2018 and updated in 2025 .  \nLegal  \nFlavio Copes, 2025 . All rights reserved.  \n[Downloaded from](Downloaded from flaviocopes.com)[ flaviocopes.com](Downloaded from flaviocopes.com).  \nNo part of this book may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.  \nThe information in this book is for educational and informational purposes only and is not intended as legal, financial, or other professional advice. The author and publisher make no representations as to the accuracy, completeness, suitability, or validity of any information in this book and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its use.  \nThis book is provided free of charge to the newsletter subscribers of Flavio Copes. It is for personal use only. Redistribution, res","cbCaioeUuljDBgY4","https://ap.wps.com/l/cbCaioeUuljDBgY4","pdf",259066,48,"English","# Preface\n# Introduction to Node.js\n# How to install Node.js\n# Modern Package Management\n# Using ES Modules in Node.js\n# File information\n# Working with folders\n# Error Handling Best Practices\n# Node.js Streams\n# Environment Configuration\n# Modern Async Pattern with async/await\n# Build an HTTP Server\n# The Node Event Loop","[{\"question\":\"What problem does Node.js solve compared with running JavaScript in the browser?\",\"answer\":\"Node.js runs the V8 JavaScript engine outside the browser, enabling server-side development with high performance. It uses asynchronous I/O primitives so operations resume when responses return instead of blocking threads.\"},{\"question\":\"How does Node.js handle many concurrent connections efficiently?\",\"answer\":\"Node.js can handle thousands of concurrent connections with a single server by avoiding per-request thread management. This reduces complexity and the bug risks associated with thread concurrency.\"},{\"question\":\"What is covered in the handbook regarding package management and security?\",\"answer\":\"The handbook explains modern package installation practices, security and maintenance considerations, and package.json best practices. It also discusses environment configuration and security considerations for safe operation.\"}]","Node.js Handbook | PDF",121,[146,150,154,158,162],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/afbe96d54876ae66b6b9d860af1581c9.webp",983,1390,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/c20042a7d0387e5055e4a7d032bd0410.webp",982,1388,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/e3460e31547694549048a6e06d54878a.webp",981,1387,{"page_no":33,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/80b5bbf607263e0a085b6d4166e071b8.webp",980,1385,{"page_no":97,"url":163,"width":164,"height":165},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/dc0496559292f0a84eaf9f4bcf4f2c41.webp",979,1384,{"list":167,"token":11},[168,174,180,186,192,198,205,212,218,224],{"doc_id":169,"doc_title":170,"file_type":137,"home_preview_img_url":171,"slug":172,"view_count":105,"category_name":29,"create_tm":173},692311,"Node.js Course","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003200153/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=PqWXpMM3FEGxjPWFC%2FUEyxUlVSE%3D","nodejs-course",1794192942,{"doc_id":175,"doc_title":176,"file_type":137,"home_preview_img_url":177,"slug":178,"view_count":97,"category_name":29,"create_tm":179},692308,"How To Code in Node.js - Chapter 1 - Getting Started","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003200056/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=4NsQS%2BMJjtmd0a4Jk2L%2B1j%2B2jj4%3D","how-to-code-in-nodejs-chapter-1-getting-started",1794192939,{"doc_id":181,"doc_title":182,"file_type":137,"home_preview_img_url":183,"slug":184,"view_count":22,"category_name":29,"create_tm":185},759801,"The Node.js Handbook - Introduction to Node.js","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044485168/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=re1ruq0MLBeF1ia0LlNPLy6cOMc%3D","the-nodejs-handbook-introduction-to-nodejs",1795895118,{"doc_id":187,"doc_title":188,"file_type":137,"home_preview_img_url":189,"slug":190,"view_count":26,"category_name":29,"create_tm":191},721616,"JavaScript From Zero to Hero - The Most Complete Guide Ever - Master Modern JavaScript Even If You’re New to Programming","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230025022797/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=swPpdkW6WwaeL1xksxsgF0RkO5o%3D","javascript-from-zero-to-hero-the-most-complete-guide-ever-master-modern-javascript-even-if-youre-new-to-programming",1795060949,{"doc_id":193,"doc_title":194,"file_type":137,"home_preview_img_url":195,"slug":196,"view_count":22,"category_name":29,"create_tm":197},759796,"Microservices with Node.js","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044484999/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=cF4GjGebheqIMKgBVxllLQoJixo%3D","microservices-with-nodejs",1795895075,{"doc_id":199,"doc_title":200,"file_type":137,"home_preview_img_url":201,"slug":202,"view_count":203,"category_name":29,"create_tm":204},40298,"Fundamentals of Web Programming Practical Tutorial","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229795184666/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=QVMmw5t4MOaikyOYjnvW6OET9kU%3D","fundamentals-of-web-programming-practical-tutorial",41,1783309396,{"doc_id":206,"doc_title":207,"file_type":137,"home_preview_img_url":208,"slug":209,"view_count":210,"category_name":29,"create_tm":211},692305,"The Complete Node.js Dev Course - Version 3 - Section Outline","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003199835/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=5b4CCrCF55E2JFAdWDMb7JwRRD0%3D","the-complete-nodejs-dev-course-version-3-section-outline",11,1794192933,{"doc_id":213,"doc_title":214,"file_type":137,"home_preview_img_url":215,"slug":216,"view_count":30,"category_name":29,"create_tm":217},697391,"Learning JavaScript - A Hands-On Guide to the Fundamentals of Modern JavaScript","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009804094/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=4Ilw9htvwqmhgUnZKEEyKroNO%2BM%3D","learning-javascript-a-hands-on-guide-to-the-fundamentals-of-modern-javascript",1794438282,{"doc_id":219,"doc_title":220,"file_type":137,"home_preview_img_url":221,"slug":222,"view_count":97,"category_name":29,"create_tm":223},692310,"Pro Node.js for Developers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003200149/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=FvNL5Wwckg7ghViu%2BCyrttk2zbI%3D","pro-nodejs-for-developers",1794192941,{"doc_id":225,"doc_title":226,"file_type":137,"home_preview_img_url":227,"slug":228,"view_count":22,"category_name":29,"create_tm":229},759799,"The World of Node.js on IBM i","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044485035/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111999&Signature=MhELWMyCCEMzYoUFBgkup2vGZaE%3D","the-world-of-nodejs-on-ibm-i",1795895080]