随笔分类 -  Node.js

摘要:We have express app: As you can see, we wrap Express App into a function 'startServer' and export it as default export. The return value of this funct 阅读全文
posted @ 2017-09-19 22:33 Zhentiw 阅读(392) 评论(0) 推荐(0)
摘要:Stateful session management: Store session which associate with user, and store in the menory on server. Sign Up: Password validation: Random bytes ge 阅读全文
posted @ 2017-09-19 01:52 Zhentiw 阅读(321) 评论(0) 推荐(0)
摘要:In this lesson we will find out how to serve static assets (images, css, stylesheets, etc.) with Express. We will go over writing initial boilerplate 阅读全文
posted @ 2017-09-19 00:48 Zhentiw 阅读(259) 评论(0) 推荐(0)
摘要:Since Node.js V8.0+, it introduces a 'util' libaray, which has a 'promisfy' function. It can conver a callback based function to promise based functio 阅读全文
posted @ 2017-08-18 02:14 Zhentiw 阅读(291) 评论(0) 推荐(0)
摘要:Learn how to setup an Nginx proxy server that sits in front of a Node.js app. You can use a proxy to control the flow of frontend requests hitting you 阅读全文
posted @ 2017-07-21 16:33 Zhentiw 阅读(259) 评论(0) 推荐(0)
摘要:In the past, you've needed to either write a package.json script or use the node_modules/.bin directory to access binaries installed in your node_modu 阅读全文
posted @ 2017-07-21 15:14 Zhentiw 阅读(159) 评论(0) 推荐(0)
摘要:As node projects evolve, new features are added all the time. This results in different errors or results as you're migrating from one version to anot 阅读全文
posted @ 2017-07-20 16:33 Zhentiw 阅读(172) 评论(0) 推荐(0)
摘要:When we try to do MongoDB opration, mongoose return Promise, we can use async/await to simply the code: The problme here is no error handling, we can 阅读全文
posted @ 2017-06-19 23:34 Zhentiw 阅读(300) 评论(0) 推荐(0)
摘要:Mixin works as a function. Here, we use include keyword to inlcude a mixin file. Exec a mixin function we can use '+': Define a mixin: Here we use som 阅读全文
posted @ 2017-06-19 22:48 Zhentiw 阅读(381) 评论(0) 推荐(0)
摘要:Mongoose has some hooks, for example: Before 'save' action, will trigger the function to generate the 'slug' JIT. 阅读全文
posted @ 2017-06-19 22:15 Zhentiw 阅读(246) 评论(0) 推荐(0)
摘要:In this lesson we'll show how to use yarn to alias the names of same npm libraries but install different versions. This could allow for easy migrating 阅读全文
posted @ 2017-06-13 01:22 Zhentiw 阅读(135) 评论(0) 推荐(0)
摘要:We can create Template Helpers, which can contains some common reuseable data and libs. Then you can define a locals data in middleware: Require helpe 阅读全文
posted @ 2017-06-12 21:08 Zhentiw 阅读(283) 评论(0) 推荐(0)
摘要:Looking at the follow code: 1. .wapper: div with wrapper class By defualt it consider as div class if you don't wirte div, just give a class name. 2. 阅读全文
posted @ 2017-06-12 03:57 Zhentiw 阅读(592) 评论(0) 推荐(0)
摘要:In this lesson we'll use cjs-to-es6 to convert CommonJS requires to ES6 imports. We'll also show how to convert over a exported default object to take 阅读全文
posted @ 2017-06-09 15:58 Zhentiw 阅读(311) 评论(0) 推荐(0)
摘要:Install: For example, we can store the sensitive information or env related information in a 'veriables.env' file: Then we can use dotenv to load thos 阅读全文
posted @ 2017-06-07 01:42 Zhentiw 阅读(437) 评论(0) 推荐(0)
摘要:In this lesson we'll show how to setup a .babelrc file with presets and plugins. Then create npm scripts that use babel-node and babel. With babel-pre 阅读全文
posted @ 2017-06-06 14:13 Zhentiw 阅读(236) 评论(0) 推荐(0)
摘要:In this lesson you will learn what a LoopBack model is, you will create a Product model using the LoopbBack CLI. The product model will be based off t 阅读全文
posted @ 2017-05-02 04:06 Zhentiw 阅读(201) 评论(0) 推荐(0)
摘要:In this lesson, we will use Chai's request method to test our Node application's API responses.By the end of this lesson, you will know how to:- insta 阅读全文
posted @ 2017-04-29 01:29 Zhentiw 阅读(340) 评论(0) 推荐(0)
摘要:When developing responsive websites, you will constantly be resizing your browser to make sure your site is properly responding to all of the resizes. 阅读全文
posted @ 2017-04-18 14:58 Zhentiw 阅读(146) 评论(0) 推荐(0)
摘要:LoopBack is a framework built on top of Express for creating APIs. It allows you to create end-to-end REST APIs that can access data from many data so 阅读全文
posted @ 2017-03-14 15:19 Zhentiw 阅读(154) 评论(0) 推荐(0)