There is no doubt that Node.js is one of the fastest growing platforms today. It can be found at start-ups and enterprises throughout all industries from high-tech to healthcare. A lot of people have written about the reasons for its popularity and w…
最近在学习Node.js相关知识,在环境搭建上耗费了不少功夫,故此把这个过程写下来同大家分享一下,今天我先来介绍一下Docker,有很多人都写过相关知识,还有一些教程,在此我只想写一下,我的学习过程中用到的一些知识和注意点. 玩过虚拟机的同学可能对Docker学习和理解就会快一点,至于Docker是什么,我就引用其官网的一句话吧:Docker is an open platform for building, shipping and running distributed applicatio…
Node.js 越来月流行,这个基于 Google V8 引擎建立的平台, 用于方便地搭建响应速度快.易于扩展的网络应用.在本文中,我们列出了2015年最佳的15个 Node.js 开发工具.这些工具对于刚刚开始学习 Node.js 的新手开发者非常有帮助.如果你知道任何其他有用的 Node.js 资源,请让我们知道. 您可能感兴趣的相关文章 Web 前端开发人员和设计师必读精华文章推荐 精心挑选的优秀jQuery Ajax分页插件和教程 12个让人惊叹的的创意的 404 错误页面设计 让网站动…
Outline 5 构建Web应用程序 5.1 构建和使用HTTP中间件 5.2 用Express.js创建Web应用程序 5.3 使用Socket.IO创建通用的实时Web应用程序 5 构建Web应用程序 5.1 构建和使用HTTP中间件 5.1.1 Web开发的常见任务: (1) HTTP服务器负责的任务 解析请求URL.维护会话关联.持久化会话数据.解析Cookie等. (2) 业务程序可以参与的任务 检查和修改请求和响应,一些Web框架正是包装了请求和响应的传递链以方面业务程序的编码工作…
[转自]http://sahandsaba.com/understanding-asyncio-node-js-python-3-4.html Introduction I spent this summer working on a web platform running on Node.js. This was the first time I worked full-time with Node.js and one thing that became quite apparent af…
UglifyJS2 这个工具使用很长时间了,但之前都是在 gulp 自动构建 时用到了 UglifyJS 算法进行压缩. 最近玩了一下 UglifyJS2 ,做了一个 在线压缩javascript工具 欢迎点击玩耍. 为什么要压缩 javascript 因为每个人开发者的书写习惯,定义参数习惯,已经使用习惯都不一样. 所以相同的功能出自不同开发者代码各异.这里牵扯到一个代码所占空间. 以前端为例来说明 大家通常都会认为,现在在网络时代,动不动就是10M光纤,拨号上网让人感觉是上个世纪的方式… 说…
原文:Callbacks are imperative, promises are functional: Node's biggest missed opportunity promises 天生就不会受不断变化的情况影响. -- Frank Underwood, 'House of Cards' 人们常说Javascript是'函数式'编程语言.而这仅仅因为函数是它的一等值,可函数式编程的很多其他特性,包括不可变数据,递归比循环更招人待见,代数类型系统,规避副作用等,它都不俱备.尽管把函数作…
You can find/fork the sample project on GitHub Hey! This and all my other tutorials will soon be moving to a new home at CloseBrace, a site for JavaScript developers. You should totally click that link right now, and sign up to be alerted when the si…
什么是流? 流是可以从一个源读取或写入数据到连续的目标对象.在Node.js,有四种类型的数据流. Readable - 其是用于读操作. Writable - 用在写操作. Duplex - 其可以用于读取和写入操作. Transform - 输出基于输入的地方进行计算的一种双相流. 每种类型的流是一个EventEmitter实例,并抛出的时代不同的实例几个事件.例如,一些常用的事件是: data - 当有数据可读取此事件. end - 当没有更多的数据读取此事件被触发. error - 当有…
Node.js是什么? Node.js是建立在谷歌Chrome的JavaScript引擎(V8引擎)的Web应用程序框架. 它的最新版本是:v0.12.7(在编写本教程时的版本).Node.js在官方网站的定义文件内容如下: Node.js® is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an even…
Node.js 越来月流行.这个基于 Google V8 引擎建立的平台, 用于方便地搭建响应速度快.易于扩展的网络应用.在本文中.我们列出了2015年最佳的15个 Node.js 开发工具.这些工具对于刚刚開始学习 Node.js 的新手开发人员很有帮助.假设你知道不论什么其它实用的 Node.js 资源,请让我们知道. 1. IO.js JavaScript I/O is an npm compatible platform that was originally based on Node…
Node.js v4.4.7 Documentation(官方文档) Buffer Prior to the introduction of TypedArray in ECMAScript 2015 (ES6), the JavaScript language had no mechanism for reading or manipulating streams of binary data(二进制数据). The Buffer class was introduced as part of…
目录 浅析Node.js的Event Loop 引出问题 Node.js的基本架构 Libuv Event Loop Event Loop Phases Overview Poll Phase The Heart Of Event Loop MacroTask VS MicroTask 它是如何工作的? 推荐阅读 参考 浅析Node.js的Event Loop 引出问题 首先看两段代码,下面两段代码的执行结果是什么?为什么? // event-loop-1.js setTimeout(() =>…
之前学习过node.js接触过express框架,最近为了编写一个mock server正好用到了express.下面正好就跟大家介绍一下关于express.今天的内容主要围绕这么几个方面? express框架初步介绍 express框架中的app.use和app.get/app.post mock server 介绍 mock server的实现思路 一.express框架初步介绍 关于express框架的介绍,这里我引用菜鸟教程的简介:Express是一个简洁而灵活的node.js web框…
Getting Node.js Apps Production Ready 部署程序需要知道的方面: Environment variables Express.js in production Socket.IO in production(在线文章缺失这章) Error handling Node.js domains for error handling Multithreading with Cluster Multithreading with Cluster2 Event loggi…
本文转自:https://malcoded.com/posts/angular-backend-express Angular is a single page application framework. Unfortunately, that does not mean that you don't require a server for certain tasks. After all, your data has to be served from somewhere... But d…
Persistence with MongoDB and Mongoose https://github.com/azat-co/practicalnode/blob/master/chapter5/chapter5.md 学习mongodb的官方网站: https://university.mongodb.com/ (免费课程,-> study guide,-> exam) https://docs.mongodb.com/manual/tutorial/getting-started/ M…
转自:https://developer.telerik.com/featured/creating-node-js-command-line-utilities-improve-workflow/ 类似的oclif Once upon a time, the command line seemed scary and intimidating to me. I felt as if it stared back at me blankly like the price tag on somet…
https://nodejs.org/docs/latest/api/addons.html Node.js Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the de style="line-height: 1.5em; font-family: Monaco, Consolas, 'Lucida Console', monospa…
Node.js v6.11.2  Documentation(官方文档) Buffer Prior to the introduction of TypedArray in ECMAScript 2015 (ES6), the JavaScript language had no mechanism for reading or manipulating streams of binary data(二进制数据). The Buffer class was introduced as part…
Node.js 操作Mongodb1.简介官网英文文档  https://docs.mongodb.com/manual/  这里几乎什么都有了MongoDB is open-source document database that provides high performance , high availability , and automatic scaling.MongoDB是一个开源的文档数据库,提供高性能.高可用性.自动缩放2.安装详细的安装相关信息,比如支持哪些系统,32位和6…
通过使用非阻塞.事件驱动的I/O操作,Node.js为构建和运行大规模网络应用及服务提供了很好的平台,也受到了广泛的欢迎.其主要特性表现为能够处理庞大的并且高吞吐量的并发连接,从而构建高性能.高扩展性的互联网应用.然而,Node.js单线程的的工作方式及有限的可管理内存使得其计算性能十分有限,限制了某些场景中的应用.近日,Jut开发团队的工程师Dave Galbraith分享了他们所遇到的Node.js的限制以及超越这些限制的方法.接下来,本文就详细分析其所遇到的问题及解决思路. 首先,Jut团…
个人翻译 原文:https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/ The Node.js Event Loop, Timers, and process.nextTick() What is the Event Loop? 什么是事件循环圈? The event loop is what allows Node.js to perform non-blocking I/O operations — despite…
Node.js NPM Tutorial – How to Get Started with NPM? NPM is the core of any application that is developed in Node.js. It provides huge sets of libraries which acts as great tools for the Node.js developers and speeds up the complete application develo…
The Node.js Event Loop, Timers, and process.nextTick() | Node.js https://nodejs.org/uk/docs/guides/event-loop-timers-and-nexttick/ What is the Event Loop? The event loop is what allows Node.js to perform non-blocking I/O operations - despite the fact…
一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该文件,会报错 4.运行test2.js 二.模块简单使用 为了编写可维护的代码,我们把很多函数分组,分别放到不同的文件里,这样,每个文件包含的代码就相对较少,很多编程语言都采用这种组织代码的方式.在Node环境中,一个.js文件就称之为一个模块(module). 模块化的开发的好处:提高代码的可维护性,避免修…
1.net模块基本API 要使用Node.js的net模块实现一个命令行聊天室,就必须先了解NET模块的API使用.NET模块API分为两大类:Server和Socket类.工厂方法. Server类如下图所示: net.Server类可以用来创建一个TCP或本地服务器,继承了EventEmitter. Socket类如下: net.Socket类一般用创建一个socket客户端或者是net.Server connection事件的参数. 工厂方法如下: 以上三个图展示了API的使用,其实NET…
1.process对象 process对象就是处理与进程相关信息的全局对象,不需要require引用,且是EventEmitter的实例. 获取进程信息 process对象提供了很多的API来获取当前进程的运行信息,例如进程运行时间.内存占用.CPU占用.进程号等,具体使用如下所示: /** * 获取当前Node.js进程信息 */ function getProcessInfo(){ const memUsage = process.memoryUsage();//内存使用 const cpu…
Stream在node.js中是一个抽象的接口,基于EventEmitter,也是一种Buffer的高级封装,用来处理流数据.流模块便是提供各种API让我们可以很简单的使用Stream. 流分为四种类型,如下所示: Readable,可读流 Writable,可写流 Duplex,读写流 Transform,扩展的Duplex,可修改写入的数据 1.Readable可读流 通过stream.Readable可创建一个可读流,它有两种模式:暂停和流动. 在流动模式下,将自动从下游系统读取数据并使用…
Javascript在客户端对于unicode编码的数据操作支持非常友好,但是对二进制数据的处理就不尽人意.Node.js为了能够处理二进制数据或非unicode编码的数据,便设计了Buffer类,该类实现了Uint8Array接口,并对其进行了优化,它的实例类似于整型数组,但是它的大小在创建后便不可调整.在介绍Buffer如何使用之前,先介绍几个知识点. 1.V8引擎的内存使用限制 V8引擎最大堆内存使用在32位系统上默认为512M,在64位系统上是1GB,虽然可以使用--max-old-sp…