Get the client's IP address in socket.io
摘要:From: https://www.wentong.org/codex/question-2018081564702.html When using socket.IO in a Node.js server, is there an easy way to get the IP address o
阅读全文
posted @
2018-09-06 15:09
今夜太冷
阅读(1366)
推荐(0) 编辑
前端 使用 crypto-js 对数据进行对称加密
摘要:From: https://www.cnblogs.com/CyLee/p/7216988.html 传送门: demo1: demo2:
阅读全文
posted @
2018-09-05 17:06
今夜太冷
阅读(3590)
推荐(0) 编辑
node-cache
摘要:From: https://www.npmjs.com/package/node-cache Simple and fast NodeJS internal caching. A simple caching module that has set, get and delete methods a
阅读全文
posted @
2018-07-31 16:09
今夜太冷
阅读(4225)
推荐(0) 编辑
Node.js Cheerio parser breaks UTF-8 encoding
摘要:From: https://stackoverflow.com/questions/31574127/node-js-cheerio-parser-breaks-utf-8-encoding [问题] 7down votefavorite 7down votefavorite I parse my
阅读全文
posted @
2018-06-21 15:53
今夜太冷
阅读(401)
推荐(0) 编辑
如何用 async 控制流程
摘要:来自: http://larry850806.github.io/2016/05/31/async/ [Javascript] 如何用 async 控制流程 (一) 31 May 2016 async async 是一個 Node.js module也可以在前端的 javascript 中直接使用讓
阅读全文
posted @
2018-06-20 17:00
今夜太冷
阅读(256)
推荐(0) 编辑
receiving error: 'Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN' while using npm
摘要:From:https://stackoverflow.com/questions/9626990/receiving-error-error-ssl-error-self-signed-cert-in-chain-while-using-npm [问题] am using npm v1.0.104/
阅读全文
posted @
2018-05-28 14:39
今夜太冷
阅读(337)
推荐(0) 编辑
VS2013创建Node.js C++ Addons的过程
摘要:首先看我的Node.js版本。 node –v v6.11.4 node –v v6.11.4 然后参照这篇文章来做: https://nodejs.org/api/addons.html#addons_hello_world npm install -g node-gyp npm install
阅读全文
posted @
2018-04-05 18:29
今夜太冷
阅读(398)
推荐(0) 编辑
node.js " The requested service provider could not be loaded or initialized"
摘要:I'm trying to use any of the NodeJS or NPM commands but I always got the following error: socket: (10106) The requested service provider could not be
阅读全文
posted @
2018-03-31 20:42
今夜太冷
阅读(861)
推荐(0) 编辑
Node.js中针对中文的查找和替换无效的解决方法
摘要:Node.js中针对中文的查找和替换无效的解决方法。 //tags的值: tag,测试,帖子 var pos1 = tags.indexOf("测"); //这里返回-1 tags = tags.replace(/,/g, ","); //这里的全角逗号没有被替换成半角逗号 怎么回事那? 【解决方法】...
阅读全文
posted @
2018-01-09 14:43
今夜太冷
阅读(304)
推荐(0) 编辑
Mongoose JS findOne always returns null
摘要:【问题】 I've been fighting with trying to get Mongoose to return data from my local MongoDB instance; I can run the same command in the MongoDB shell and I get results back. I have found a post on stac...
阅读全文
posted @
2017-11-28 16:27
今夜太冷
阅读(248)
推荐(0) 编辑
Mongoose Connection best practice
摘要:There is often quite a lot of confusion about how best to set up a database connection with Mongoose. So I thought I'd clear it up! There are two ways
阅读全文
posted @
2017-11-21 10:05
今夜太冷
阅读(187)
推荐(0) 编辑
Mongoose的分页功能
摘要:来自: https://github.com/edwardhotchkiss/mongoose-paginate 拷贝如下: Note:This plugin will only work with Node.js >= 4.2 and Mongoose >= 4.2 Installation npm install mongoose-paginate Usage Add plugin ...
阅读全文
posted @
2017-11-03 09:53
今夜太冷
阅读(3911)
推荐(0) 编辑
Mongoose vs mongodb native driver – what to prefer?
摘要:Paul Shan 7th Jun 2015 Mongoose or mongodb native driver, which one to use? This is one of the initial queries for a node-mongo developer; and probably one of the most important ones. Because one us...
阅读全文
posted @
2017-10-31 16:29
今夜太冷
阅读(297)
推荐(0) 编辑
Node.js中exports与module.exports的区别
摘要:你肯定对Node.js模块中用来创建函数的exports对象很熟悉(假设一个名为rocker.js的文件): exports.name = function() { console.log('My name is Lemmy Kilmister'); }; 然后你在另一个文件中调用: var rocker = require('./rocker.js'); rocker....
阅读全文
posted @
2017-10-30 15:36
今夜太冷
阅读(204)
推荐(0) 编辑
Node js : Best way to define entity class
摘要:If you start to use a DB like mongo, you might be better off creating objects with mongoose but that's personal preference as well. As for your example - 1) Export Person module.exports = Person; ...
阅读全文
posted @
2017-10-30 15:26
今夜太冷
阅读(172)
推荐(0) 编辑
Express application generator的使用
摘要:首先拷贝express官网的一篇文章: (http://expressjs.com/en/starter/generator.html ) Express application generator Use the application generator tool,express-generator, to quickly create an application skeleton. Th...
阅读全文
posted @
2017-10-25 17:09
今夜太冷
阅读(267)
推荐(0) 编辑
通读cheerio API
摘要:所谓工欲善其事,必先利其器,所以通读了cheerio的API,顺便翻译了一遍,有些地方因为知道的比较少,不知道什么意思,保留了英文,希望各位不吝告诉我,然后一起把这个翻译完成。 ###cheerio 为服务器特别定制的,快速、灵活、实施的jQuery核心实现. ###Introduction 将HTML告诉你的服务器 var cheerio = require('che...
阅读全文
posted @
2017-08-24 15:32
今夜太冷
阅读(283)
推荐(0) 编辑
Node.js中 express-session的奇怪问题
摘要:var session = require('express-session'); app.use(cookieParser()); app.use(session({ secret: '123' })); ß-第71行 登录以后访问的时候有时候会报这样的错误: The last 64k of the output generated by the node.exe p...
阅读全文
posted @
2017-07-27 00:16
今夜太冷
阅读(457)
推荐(0) 编辑
Note.js的stream用法一例
摘要:Note.js,用stream读取文件的内容,注意decoder的用法 const fs = require('fs'); var rr = fs.createReadStream('data\\foo.txt'); // Pull off a header delimited by \n\n // use unshift() if we get too much // Call th...
阅读全文
posted @
2016-05-31 17:23
今夜太冷
阅读(681)
推荐(0) 编辑
Node.js中的HTTPS示例
摘要:需要openssl的支持, openssl本身不提供windows的安装程序,可以按照如下的步骤进行安装: (参考https://conetrix.com/Blog/how-to-install-openssl-on-windows-7,并复制到下面) How-to Install OpenSSL on Windows 7 Download and runthe Cygwin install...
阅读全文
posted @
2016-05-24 13:52
今夜太冷
阅读(7071)
推荐(0) 编辑