随笔分类 -  node.js

服务器的路由
摘要:const https = require('http')//引入系统模块HTTP const app = https.createServer();//创建网站服务器 const url = require('url') // 为网站服务器对象添加请求事件 app.on('request',(req,res) => { // 获取请求方式 为了判断方便并使用toLowerCase()... 阅读全文
posted @ 2019-07-25 21:54 毛不易的小老婆 阅读(194) 评论(0) 推荐(0)
我的第一个web服务器
摘要:// 创建web服务器 //引用系统模块 const http = require('http') //用于创建网站服务器的模块 //创建web服务器 const app = http.createServer(); //app就是网站服务器对象 //当客户端发送请求时 app.on('request', (req, res) => { // 获取输出请求方式 console... 阅读全文
posted @ 2019-07-25 20:15 毛不易的小老婆 阅读(210) 评论(0) 推荐(0)
Node.js中模块的加载机制
摘要:// 1.require(path) require('./find.js') //2 require(path) path后缀名省略 require('./find) // 在当前路径下找同名js文件 再找同名js文件夹 // 若找到了 同名文件夹 找文件夹中的index.js //若没有Index.js 就会去当前文件夹中的package.js文件中... 阅读全文
posted @ 2019-07-24 22:22 毛不易的小老婆 阅读(563) 评论(0) 推荐(0)
gulp的使用
摘要:const gulp = require('gulp'); const htmlmin = require('gulp-htmlmin'); const fileinclude = require('gulp-file-include') const less = require('gulp-less') const csso = require('gulp-csso') const babel... 阅读全文
posted @ 2019-07-24 02:52 毛不易的小老婆 阅读(147) 评论(0) 推荐(0)
npm 和 模块化
摘要:// shift + 鼠标右键 在文件夹中可快捷打开 cmd // clear 清除 // node.js中规定一个JavaScript文件就是一个模块 模块内定义的变量和函数外部无法得到 //模块内部 使用exports对象进行成员导出 使用require方法导入其他模块 // node.js本质上是模块化的依赖开发 ... 阅读全文
posted @ 2019-07-24 00:08 毛不易的小老婆 阅读(268) 评论(0) 推荐(0)
node.js第一天
摘要:var a = ['hello','world']; console.log(typeof(a));//object var b =a; b[0] = 'bye'; console.log(a[0]);//'bye' console.log(b[0]);//'bye' console.log(typ 阅读全文
posted @ 2019-07-22 20:52 毛不易的小老婆 阅读(161) 评论(0) 推荐(0)