摘要:https://blog.csdn.net/yunchong_zhao/article/details/119836038 新版本的webpack-cli 中引入了 这个模块安装下就可以了 cnpm i acorn --save-dev aocrn: 一个用JavaScript编写的小型、快速的Ja
阅读全文
摘要:1、为了测试,在windows系统安装redis 参考:windows安装解压版redis demo结构: 2、代码 pageage.json { "name": "redis_pub_sub_demo", "version": "1.0.0", "description": "", "main":
阅读全文
摘要:simple-statistics官网:https://simplestatistics.org/docs/#median demo结构: package.json { "name": "react-blank", "version": "0.1.0", "private": true, "depe
阅读全文
摘要:使用chalk定义输出样式:Chalk comes with an easy to use composable API where you just chain and nest the styles you want. const chalk = require('chalk') console
阅读全文
摘要:import React from 'react' import copy from 'copy-to-clipboard' export default class App extends React.Component { constructor(props) { super(props) th
阅读全文
摘要:console.log(Qs.stringify({id: link, key: secretKey}))输入结果格式;url编码后的 id=64d478c0-3904-11ea-a21e-fdd8236927e9&key=73QjHap%2BX0SR6Erqs%2F4BLQ%3D%3D impor
阅读全文
摘要:1、nodejs //传入请求HttpRequest function getClientIp(req) { return req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAddre
阅读全文
摘要:1、参考文档1:https://github.com/chimurai/http-proxy-middleware#compatible-servers 2、点开上图链接 https://github.com/http-party/node-http-proxy#listening-for-prox
阅读全文
摘要:https://blog.csdn.net/weixin_34221036/article/details/91421667
阅读全文
摘要:// 需求:封装一个方法,给一个读取文件的路径,方法能给我们返回文件内容 const fs = require('fs') const path = require('path') // callback回调:第一个参数错误结果,第二个参数读取的文件内容 function getFileByPath
阅读全文
摘要:例子来源:http://www.runoob.com/nodejs/nodejs-event-loop.html http://www.runoob.com/nodejs/nodejs-event.html EventEmitter 的每个事件由一个事件名和若干个参数组成,事件名是一个字符串,通常表
阅读全文
摘要:1、CommonJS 我们只是在js文件中写下console.log('This is a test.');这句代码,node.js执行该js文件时: ( function(exports, require, module, __filename, __dirname) { console.log(
阅读全文
摘要:1、网站 https://ejs.co/ https://ejs.bootcss.com/ 2、app.js pages/detail.html pages/list.html
阅读全文
摘要:1、官网:http://expressjs.com/ 中文:http://www.expressjs.com.cn/ 2、HelloWorld 1)mkdir node-express-demo 2)cd .\node-express-demo\ 3)新建app.js文件 4)npm init -y
阅读全文
摘要:1、node.js中模块的分类 1)node.js内置模块(核心,原生) 所有内置模块在安装node.js时就已经编译成二进制文件,可以直接加载运行(速度较快),部分内置模块,在node.exe这个进程启动时就已经默认加载了,可以直接使用。 2)文件模块 require(./common.js);
阅读全文
摘要:需求:图书的增删改查,图书数据保存在data.json文件中。 1、Demo结构: 2、首先下载安装node.js,配置环境变量:参考博客 3、项目初始化 1)创建项目根目录node-hello,进入到根目录node-hello,右键/在此处打开PowerShell窗口。 2)创建app.js文件。
阅读全文
摘要:1、链接 npm underscore:https://www.npmjs.com/package/underscore 官网:https://underscorejs.org/ 2、npm安装:npm install underscore 3、简单使用
阅读全文
摘要:一、npm介绍 1)npm:node package manager是node.js默认的以js编写的软件包管理系统 官网:www.npmjs.com 文档:docs.npmjs.com 2)提到npm可能指的是: npm这个网站 npm这个js代码仓库 npm客户端 3)npm是node.js默认
阅读全文
摘要:目录:一、构建http服务程序-根据不同请求做出不同响应二、根据用户不同请求,读取不同HTML文件响应三、响应的HTML文件中包含图片的处理方式四、根据后缀查询MIME类型五、案例:不同url请求不同html页面,页面包含图片、样式css等静态资源六、request对象七、response对象常用成
阅读全文
摘要:目录:一、node.js介绍二、node.js有哪些特点三、下载安装node.js,配置环境变量四、node.js开发网站和传统PHP等开发网站的区别五、REPL介绍六、helloworld程序七、案例:输出一个三角形八、fs写入文件和读取文件九、__dirname和__filename获取正在执行
阅读全文