Node.js
文章平均质量分 62
SalmonellaVaccine
这个作者很懒,什么都没留下…
展开
-
在centOS上安装Node
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-serverInstall a Package from the Node SiteAnother option for installing Node.js on your server is to转载 2017-11-07 10:53:51 · 453 阅读 · 0 评论 -
Keep a node.js server up with Forever
https://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever/One of the great benefits of using node.js is the reduction in dependencies needed to run a production web application. By using转载 2016-07-22 12:51:50 · 453 阅读 · 0 评论 -
Nodis - 前缀匹配、模糊搜索, 基于redis和node.js
http://www.phonegap100.com/athreadinfo_5639.htmlNodisgithub - Nodis基于redis和node.js, 支持前缀匹配和模糊匹配搜索, 如用户名搜索、文章标题搜索等.使用了zookeeper和thrift, 客户端可用任何支持thrift的语言实现, 也可很容易地移除这两部分代码.很容易即可更改为转载 2016-06-06 14:32:11 · 2550 阅读 · 0 评论 -
Nodejs Error: EMFILE
http://stackoverflow.com/q/13192660/2177408I need to open a directory containing files.. open readstream for each and write the data from all the files into a single file. But I keep getting转载 2016-05-22 16:14:35 · 1291 阅读 · 0 评论 -
npm install contextify问题解决
今天要用别人一个react的例子,在npm install的过程中,安装contextify时遇到了若干问题,最后逐一解决。问题1:Failed at the contextify@0.1.14 install script 'node-gyp rebuild'解决方法:https://github.com/bevacqua/perfschool/issues/5#issuec原创 2016-06-03 03:13:22 · 3709 阅读 · 0 评论 -
callback to handle completion of pipe
http://stackoverflow.com/q/11447872/2177408I am using the following node.js code to download documents from some url and save it in the disk. I want to be informed about when the document is d转载 2016-05-17 11:45:52 · 679 阅读 · 0 评论 -
promise Q.all 方法使用 及 spread 分散返回结果
http://yijiebuyi.com/blog/ff153c94cb841f36b8e5da98242871e0.html一介布衣 2015-11-12 nodejs 779promise 规范点击查看此博文了解 promise规范让你解脱callback回调噩梦promise 规范 开源包 Q 使用点击查看博文 n转载 2016-05-17 11:39:13 · 2087 阅读 · 0 评论 -
用node-webkit把web应用打包成桌面应用
nwjs打包app的官方文档写得很烂,下面这个博客是基本是翻译的官方文档,还有举例和配图,清楚得多。很遗憾的是,nwjs的官方文档已经烂到了不能用,按上面的步骤来得到的结果是nwjs can't extract the files from the package,浪费了我两个小时才搞清楚这一点。这也是下面转载的这篇文章从Enigma Virtual Box之后部分的价值所在。转载 2015-10-22 13:48:45 · 776 阅读 · 0 评论 -
.和..在路径中的区别
最近在做一个nwjs + nodejs + polymer的项目。项目快做好了,需要把代码打包成可以直接运行的文件。本来的文件结构是:app--bower_components--node_modules--src |--client |--index.html |--elements.htmlindex.html原创 2015-10-20 11:45:00 · 465 阅读 · 0 评论 -
Node.js Request Module…sending json in body for api request with put
http://stackoverflow.com/questions/21359877/node-js-request-module-sending-json-in-body-for-api-request-with-put用Node.js的Request模块发送post请求,request body为JSON对象,需要设置json: truevar options = { u转载 2015-10-05 16:25:01 · 815 阅读 · 0 评论 -
Javascript Promises Are Awesome
http://ghost.deceptacle.com/2014/03/26/javascript-promises-are-awesome/26 Mar 2014I have completely fallen in love with Javascript promises. There's plenty of other blog posts going into more转载 2015-08-02 02:17:13 · 468 阅读 · 0 评论 -
利用promise写出更加优美的nodejs程序
http://my.oschina.net/sundq/blog/227410摘要 nodejs所有的操作都是异步和callback模式,这样做的坏处是很容易造成或掉函数调用大坑,本文介绍如何使用promise写出更简洁明了的程序。nodejs promise callback hell目录[-]什么是promise将一般的异步调用的函数转载 2015-08-12 13:36:22 · 638 阅读 · 0 评论 -
NodeJs教程
By 特首http://markpop.github.io/2014/10/29/NodeJs%E6%95%99%E7%A8%8B/介绍随着Node.js的发展,Javascript应用在这几年突飞猛进的流行。如果你去modulecounts.com上看看,你会发现Node packages已经超过了Ruby。另外Node packages的发展速度已经超过了Ruby、Pyth转载 2015-08-12 13:32:30 · 545 阅读 · 0 评论 -
在 Node.js 中用 Q 实现 Promise – Callback 之外的另一种选择
http://www.ghostchina.com/promises-in-node-js-with-q-an-alternative-to-callbacks/作者:王赛 • 2014年3月2日怎么写异步代码?相对原始的 callback 而言,promise 无疑是更好的选择。可掌握promise 的概念及其用法可能不太容易, 而且很有可能你已经放弃它了。但经过一大波码农的努力,p转载 2015-08-12 13:35:13 · 801 阅读 · 0 评论 -
Yelp API(v2) with Mode.js support--handling of authentication
http://franklingu.github.io/development/2015/06/28/yelp-api-with-node-js-support/What is Yelp? Well, to me is just TripAdviser just with better APIs, although the official introduction goes转载 2016-07-12 15:01:52 · 496 阅读 · 0 评论 -
Express Error: No default engine was specified and no extension was provided
http://stackoverflow.com/questions/23595282/error-no-default-engine-was-specified-and-no-extension-was-providedError: No default engine was specified and no extension was provided. at new Vie转载 2016-07-12 16:57:12 · 5802 阅读 · 0 评论 -
MEAN全栈开发:使用NodeJS和MongoDB创建REST服务
http://gocwind.com/blog/2015/06/09/creating-a-restful-api-tutorial-with-nodejs-and-mongodb/本教程介绍如何使用Node.js (Express.js) 和MongoDB (mongoose) 创建REST服务。你可以参考本教程创建一个独立的后台服务,也可以回顾之前的AngularJS或转载 2016-07-12 16:59:14 · 2371 阅读 · 0 评论 -
API 服务器搭建笔记:CentOS + Node.js + MongoDB
http://harttle.com/2015/02/24/node-web-api.html本文尝试在CentOS服务器上,使用js来构建整个web服务,包括nodejs运行时、MongoDB json风格数据库、redis内存数据库。首先安装这些软件:# centosyum install git nodejs npm mongodb mongodb-server r转载 2017-02-19 01:59:51 · 511 阅读 · 0 评论 -
Refactoring Mongoose with Q
https://medium.com/@AdamRNeary/refactoring-mongoose-with-q-99d2759a97b6#.4hq41cfpfBetter API Code. I Promise.Yikes! Why is it that an engineer who generally writes beautiful, meticulous转载 2017-02-19 01:31:40 · 373 阅读 · 0 评论 -
Request —— 让 Node.js http请求变得超简单
https://segmentfault.com/a/1190000000385867先前一直比较关注前端的东西,对后端了解较少。不过一直对Node.js比较感兴趣,去年12月还去参加了阿里的CNODE交流聚会。以后希望通过这里的博客分享一些学习Node.js的笔记。一方面总结了自己的学习心得,另一方面也可以和大家一起分享交流。嗯,大概就是这样子。这篇就先介绍一个Nod转载 2017-02-19 01:28:02 · 425 阅读 · 0 评论 -
Amazon EC2 Instance Express API配置HTTPS
最近在做一个API的项目,放在Amazon EC2上跑,为了提高安全性想把链接搞成HTTPS的。API放在Express上,GoDaddy上面没有Node Server配置的教程,搜到很多教程都是通过AWS Load Balancer来配置的,所以自己把各教程综合了一下,完成了配置。第一步:买一个SSL证书我看很多人都是自己签发证书。但是我因为有折扣,打完折之后$3/年,很便宜,就原创 2017-01-05 08:10:15 · 1822 阅读 · 0 评论 -
Express.js Middleware Tutorial
http://qnimate.com/express-js-middleware-tutorial/Developers who are new to Express often get confused with the difference between route handler and middleware. Therefore they also get confused wi转载 2016-12-30 14:28:37 · 373 阅读 · 0 评论 -
Set CORS on Express API
http://stackoverflow.com/a/21622564/2177408I found the easiest way is to use the node.js package cors. The simplest usage is:var cors = require('cors')var app = express()app.use(cors(转载 2016-12-30 14:25:53 · 466 阅读 · 0 评论 -
Building Faster APIs with NodeJs and Redis
https://coligo.io/nodejs-api-redis-cache/In this tutorial we will be building an API to compute the total number of stars a GitHub user has across all their public repositories. We'll be using:转载 2016-12-28 12:54:23 · 357 阅读 · 0 评论 -
Using Redis with Node.js
https://www.sitepoint.com/using-redis-node-js/Redis is a fast and efficient in-memory key-value store. It is also known as a data structure server, as the keys can contain strings, lists, sets转载 2016-12-26 13:40:09 · 316 阅读 · 0 评论 -
nodejs读取本地中文json文件出现乱码
1. 确定json文件是UTF-8 无BOM编码的的。如果有BOM,会在读取第一行的时候出现乱码。Per "fs.readFileSync(filename, 'utf8') doesn't strip BOM markers #1918", fs.readFile is working as designed: BOM is not stripped from the heade原创 2016-12-19 03:43:37 · 8356 阅读 · 0 评论 -
How to disable 'withcredentials' in HTTP header with node.js and Request package?
http://stackoverflow.com/questions/24433099/how-to-disable-withcredentials-in-http-header-with-node-js-and-request-packageQuestion:Using node.js and the Request package from the browser (via转载 2016-09-27 00:46:52 · 605 阅读 · 0 评论 -
通过SSH部署Node app到Amazon EC2
最近需要写一个简单的API并部署到EC2上,步骤备忘如下:1. 通过AWS Dashboard新建一个ubuntu EC2 instance过程简单,不再赘述。新建过程中AWS会提示要不要新建一个私钥.pem文件,Yes。2. 通过PuTTYgen和PuTTY远程SSH登录虚拟机具体步骤见Connecting to Your Linux Instan原创 2016-07-18 08:54:15 · 1057 阅读 · 0 评论 -
Express Morgan not writing logs to file or STDOUT
http://stackoverflow.com/questions/35904450/express-morgan-not-writing-logs-to-file-or-stdoutI figured it out- the logging code needed to be located in the app.js file, not in the file that转载 2016-07-12 17:43:53 · 741 阅读 · 0 评论 -
Build a RESTful API Using Node and Express 4
https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4Chris SevillejaApr 15, 2014With the release of Express 4.0 just a few days ago, lots of our Node apps will hav转载 2016-07-12 17:02:20 · 782 阅读 · 0 评论 -
在Node.js中使用promise摆脱回调金字塔
http://nya.io/Node-js/promise-in-nodejs-get-rid-of-callback-hell/在开始谈论正题之前,我们先来看看下面一段代码:123456789step1(function (value1) { step2(value1, function(value2) {转载 2015-08-12 13:27:29 · 1263 阅读 · 0 评论 -
NodeJS async实例详解:When to use what?
例子把这个库怎么用讲得很清楚。http://www.sebastianseilund.com/nodejs-async-in-practiceWhen I started out using node.js and async I didn't find any good/thorough resources on how to really use the async mod转载 2015-07-20 06:00:48 · 813 阅读 · 0 评论 -
errno: 34, code: 'ENOENT' in fs
http://stackoverflow.com/a/27026780/2177408ENOENT typically means the file/directory doesn't existCheck your path. If you were making multiple levels of directories, you will usually g转载 2015-02-05 06:10:37 · 1114 阅读 · 0 评论 -
用Highcharts轻松构建交互性图表
http://blog.fens.me/nodejs-highcharts/从零开始nodejs系列文章,将介绍如何利Javascript做为服务端脚本,通过Nodejs框架web开发。Nodejs框架是基于V8的引擎,是目前速度最快的Javascript引擎。chrome浏览器就基于V8,同时打开20-30个网页都很流畅。Nodejs标准的web开发框架Express,可以帮助我转载 2015-02-05 05:59:46 · 1042 阅读 · 0 评论 -
通读cheerio API
https://cnodejs.org/topic/5203a71844e76d216a727d2e所谓工欲善其事,必先利其器,所以通读了cheerio的API,顺便翻译了一遍,有些地方因为知道的比较少,不知道什么意思,保留了英文,希望各位不吝告诉我,然后一起把这个翻译完成。###cheerio为服务器特别定制的,快速、灵活、实施的jQuery核心实现.###Introduct转载 2015-02-05 05:55:46 · 537 阅读 · 0 评论 -
记录nodejs中async的几个接口用法
http://blog.csdn.net/sxyizhiren/article/details/18240435这些天使用async用的较多,确实简化了代码。这里记录使用到的几个接口,给自己和需要的人参考。1.async.waterfall用法:async.waterfall(tasks, [callback]);task是函转载 2015-02-05 05:20:10 · 852 阅读 · 0 评论 -
npm 安装参数中的 --save-dev
http://segmentfault.com/q/1010000000403629当你为你的模块安装一个依赖模块时,正常情况下你得先安装他们(在模块根目录下npm install module-name),然后连同版本号手动将他们添加到模块配置文件package.json中的依赖里(dependencies)。-save和save-dev可以省掉你手动修改package.转载 2015-02-05 04:58:25 · 1601 阅读 · 0 评论 -
从零开始搭建Node.js, Express, Ejs, Mongodb服务器
http://www.toolmao.com/nodejs-express-ejs-mongodb-server本文改自非鱼的《【翻译】前端开发人员入门指南,从零开始搭建Node.js, Express, Jade, Mongodb服务器》,之所以把Jade换成Ejs,是因为我觉得ejs更符合WEB编程人员的习惯,更确切说应该是更符合PHP、ASP程序员的使用习惯。好了,废话不多说转载 2015-02-05 06:48:20 · 1279 阅读 · 0 评论 -
使用 superagent 与 cheerio 完成简单爬虫
https://github.com/alsotang/node-lessons/tree/master/lesson3目标建立一个 lesson3 项目,在其中编写代码。当在浏览器中访问 http://localhost:3000/ 时,输出 CNode(https://cnodejs.org/ ) 社区首页的所有帖子标题和链接,以 json 的形式。转载 2015-02-05 06:19:22 · 873 阅读 · 0 评论 -
async.js 学习教程(一)
http://www.cnblogs.com/fly-dog/p/3657055.html网上有一篇async.js的文章,但是看完后一头雾水,里面很多错误,只好学习下官方的文档官方的文档分为三个模块:1.Collections 集合2.Control Flow 控制流程3.Utils 公共模块最常用的应该就是第二个模块了,async的转载 2015-02-05 05:53:39 · 560 阅读 · 0 评论