npx
摘要:【npx】 1、临时使用安装。 老方法: npx方式: 这条命令会临时安装 create-react-app 包,命令完成后create-react-app 会删掉,不会出现在 global 中。下次再执行,还是会重新临时安装。2 2、调用 ./node_module/.bin 下的命令 过去: 现
阅读全文
node-rsa
摘要:【node-rsa】 引用 生成一个私钥长度为512的key(同时生成公钥) 使用公钥加密(当然,加密都是指用公钥加密) 使用私钥解密(当然,解密都是指用私钥解密) 导出公钥、私钥 导入公钥、私钥 参考:https://www.npmjs.com/package/node-rsa
阅读全文
Base64 Encoding / Decoding in Node.js
摘要:【Base64 Encoding / Decoding in Node.js】 Here is how you encode normal text to base64 in Node.js: And here is how you decode base64 encoded strings: If
阅读全文
node-pre-gyp install --fallback-to-build 错误
摘要:【node-pre-gyp install --fallback-to-build 错误】 npm install bcrypt时遇上错误 此时,安装node-gyp 然后,再安装bcrypt即可。 【node-gyp】 Node.js native addon build tool node-gy
阅读全文
session of express
摘要:【session of express】 1、express-session 一个提供session功能库 1)session的key必须与cookieParser的key一致 2)resave选项,true | false。当session未发生变化时,是否将session重新写入数据库(重置ex
阅读全文
Nodejs this详解
摘要:【Nodejs this详解】 Nodejs中, 文件层this,指向的是module.export。 函数层this,指向的是global对象。 参考:http://www.jb51.net/article/81556.htm
阅读全文
NPM安装依赖速度慢问题
摘要:【NPM安装依赖速度慢问题】 npm config set registry http://registry.npm.taobao.org 参考:http://blog.csdn.net/rongbo_j/article/details/52106580
阅读全文
JSON.parse()和JSON.stringify()
摘要:【JSON.parse()和JSON.stringify()】 parse用于从一个字符串中解析出json对象,如 var str = '{"name":"huangxiaojian","age":"23"}' 注意:单引号写在{}外,每个属性名都必须用双引号,否则会抛出异常。 stringify(
阅读全文
签名Cookie
摘要:【签名Cookie】 set-cookie时加上防篡改验证码。 如: user_name=alex|bj95ef23cc6daecc475de 防篡改验证码的生成规则可以很简单:md5(cookieValue+key)或sha1(cookieValue+key),key可以是服务器端掌握的一个固定字
阅读全文
fs.watchFile
摘要:【fs.watchFile】 fs.watchFile(filename[, options], listener) Watch for changes on filename. The callback listener will be called each time the file is a
阅读全文
series of Nimble
摘要:【nimble】 series方法用于串行执行多个异步任务,通过npm可安装nimble。 Series works similarly to parallel, only it runs each function only once the previous has finished. Agai
阅读全文
node 加载逻辑
摘要:【node 加载逻辑】 参考:https://nodejs.org/api/modules.html
阅读全文
package.json bin
摘要:【package.json bin】 1、bin field in your package.json which is a map of command name to local file name. On install, npm will symlink that file into pre
阅读全文
npm run build
摘要:【npm run build】 npm 会在项目的 package.json 文件中寻找 scripts 区域,其中包括npm test和npm start等命令。 其实npm test和npm start是npm run test和npm run start的简写。事实上,你可以使用npm run
阅读全文
npm install --save 与 npm install --save-dev 的区别
摘要:【npm install --save 与 npm install --save-dev 的区别】 缩写: -S就是--save的简写 -D就是--save-dev 这样安装的包的名称及版本号就会存在package.json的devDependencies这个里面,而--save会将包的名称及版本号
阅读全文
MySQL driver for Node
摘要:【MySQL driver for Node】 1、安装 2、一个示例 From this example, you can learn the following: Every method you invoke on a connection is queued and executed in
阅读全文
Debug模块
摘要:【Debug模块】 一个用于控制日志输出的模块。 参考: 1、http://www.jianshu.com/p/6b9833748f36 2、https://www.npmjs.com/package/debug
阅读全文
Node KeyNote
摘要:【Node KeyNote】 1、实际上,.node文件在windows下它是一个.dll文件,在*nix下则是一个.so文件。 2、默认变量 function(exports, require, module, __filename, __dirname){ } 3、通过dlopen()方法加载.
阅读全文
NodeJS搭建HTTPS服务器
摘要:【NodeJS搭建HTTPS服务器】 1、创建服务端证书。 服务器代码: 2、创建客户端证书。 客户端代码: 参考: 1、http://cnodejs.org/topic/54745ac22804a0997d38b32d
阅读全文
npm常用命令
摘要:【nodejs中npm常用命令】 npm is the package manager for JavaScript. Find, share, and reuse packages of code from hundreds of thousands of developers — and ass
阅读全文