参考:博客 https://www.cnblogs.com/chentianwei/p/10268346.html 参考: mongoose官网(https://mongoosejs.com/docs/models.html) 参考: 英文:Boosting Node.js和MongoDB with Mongoose 简介:mongoose Mongoose is a fully developed object document mapping (ODM) library for Node.j…
Real-Time Apps with WebSocket, Socket.IO, and DerbyJS 实时程序的使用变得越来越广泛,如传统的交易,游戏,社交,开发工具DevOps tools, 云服务,新闻. 之所以如此是因为技术的进步.更大的带宽用来传输数据和更多的计算来处理和取回数据. HTML5的新实时连接标准叫做,WebSocket. 在浏览器,JavaScript给你一个对象WebSocket.这个对象是一个类,它有各类方法用于生成WebSocket protocol clien…
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…
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…
TDD and BDD for Node.js with Mocha TDD测试驱动开发.自动测试代码. BDD: behavior-driven development行为驱动开发,基于TDD.一种自然化的测试语言. 例如,使用expect(response.status).to.equal(200)代替了TDD的assert.equal(response.status, 200) Mocha文档:https://mochajs.org/ chai: 官网文档:  https://www.ch…
Building Node.js REST API Servers with Express.js and Hapi Modern-day web developers use an architecture consisting of a thick client and a a thin back-end layer.如AngularJS,ReactJs, VueJS.用来建立厚厚的client. 另一方面,他们使用REST APIs建立thin back-end layer. a repr…
Template Engines: Pug and Handlebars 一个模版引擎是一个库或框架.它用一些rules/languages来解释data和渲染views. web app中,views可能是HTML pages(或部分它们),但是也可以是JSON, XML文件, 或者在desktop programs中是GUIs. MVC框架,templates属于view. 在web app内,使用模版可以动态地生成无限多个pages. 之后讲如何使用Pug和Handlebars 然后是:…
新增的章节. If you are not using HTTP/2, then you are losing out on big improvements. HTTP/2相比http/1有很大的区别.例如: multiplexing 多路复用 server push of assets 如果您没有用HTTP/2优化代码,那么您的应用程序可能比使用HTTP/2要慢. 大量http/1的网页优化实际已经不需要了,甚至它们可能会伤到HTTP/2. 本章介绍一些主要功能,你需要阅读它并跟着它进行更多…
Asynchronous Code in Node 历史上,Node开发者只能用回调和事件emitters. 现在可以使用一些异步的语法: async module Promises Async/await funcitons Promise the docs, 在hook下,一个基本的promise的运行. Promises不是取代callback,它仍然使用callback. 例子: 这是传统的callback用法 function myAsyncTimeoutFn(data, callba…
大神的node书,免费 视频:https://node.university/courses/short-lectures/lectures/3949510 另一本书:全栈JavaScript,学习backbone.js node.js and MongoDB. 1,2章: Setting up Node.js and Other Essentials [2nd Edition] Using Express.js 4 to Create Node.js Web Apps [2nd Edition…