文章 2022-04-12 来自:开发者社区

Node.js(二)node 核心模块 fs、HTTP模块、express框架

一、核心模块(FS模块)        fs 模块是文件系统模块:用于文件操作,分文件形式和目录形式,使用前需先导入 fs 模块:const fs = require('fs');1. 常用API:2. 同步和异步//同步:在主线程中执行,会阻止后续代码的执行,通过返回值获取结果 let s = fs.stat//异步:在一个独立的线程...

Node.js(二)node 核心模块 fs、HTTP模块、express框架
文章 2016-05-20 来自:开发者社区

nodejs模块——http模块

// 处理url请求 var fs = require('fs'); // home.html 主页 function home(res) { console.log('Request handler "home" was called.'); // 读取home.html文件 var content = fs.readFileSync('./views/home....

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

产品推荐

{"cardStyle":"productCardStyle","productCode":"aliyun","productCardInfo":{"productTitle":"从 HTTP 到 HTTPS 让网站更安全","productDescription":"本方案介绍如何在ECS上搭建Web应用以及在Nginx服务器上部署SSL证书开启HTTPS安全访问。","productContentLink":"https://www.aliyun.com/solution/tech-solution/ssl","isDisplayProductIcon":true,"productButton1":{"productButtonText":"方案详情","productButtonLink":"https://www.aliyun.com/solution/tech-solution/ssl"},"productButton2":{"productButtonText":"方案部署","productButtonLink":"https://help.aliyun.com/document_detail/2684684.html"},"productButton3":{"productButtonText":"查看更多技术解决方案","productButtonLink":"https://www.aliyun.com/solution/tech-solution/"},"productPromotionInfoBlock":[{"$id":"0","productPromotionGroupingTitle":"解决方案推荐","productPromotionInfoFirstText":"通过弹性公网IP确保服务迁移时公网IP不变","productPromotionInfoFirstLink":"https://www.aliyun.com/solution/tech-solution/eip_service","productPromotionInfoSecondText":"网站静态资源访问加速","productPromotionInfoSecondLink":"https://www.aliyun.com/solution/tech-solution/oss-x-cdn"}],"isOfficialLogo":false},"activityCardInfo":{"activityTitle":"","activityDescription":"","cardContentBackgroundMode":"LightMode","activityContentBackgroundImageLink":"","activityCardBottomInfoSelect":"activityPromotionInfoBlock"}}