@@ -237,7 +237,7 @@ npm基本命令
237237| --- | --- | --- |
238238| npm install xxx | 安装xxx模块,但不记录到package.json里 | npm i xxx |
239239| npm install --save xxx | 安装xxx模块,并且记录到package.json里,字段对应的dependency,是产品环境必须依赖的模块 | npm i -s xxx |
240- | npm install --save-de xxx | 安装xxx模块,并且记录到package.json里,字段对应的dev-dependency,是开发环境必须依赖的模块,比如测试类的(mocha、chai、sinon、zombie、supertest等)都在 | npm i -D xxx |
240+ | npm install --save-dev xxx | 安装xxx模块,并且记录到package.json里,字段对应的dev-dependency,是开发环境必须依赖的模块,比如测试类的(mocha、chai、sinon、zombie、supertest等)都在 | npm i -D xxx |
241241| npm install --global xxx | 全局安装xxx模块,但不记录到package.json里,如果模块里package.json有bin配置,会自动链接,作为cli命令 | npm i -g xxx |
242242
243243### 常用软件
@@ -516,7 +516,7 @@ Async/Await是异步操作的终极解决方案,Koa 2在node 7.6发布之后
516516
517517这里给出一段Koa 2应用里的一段代码
518518
519- ```
519+ ``` js
520520exports .list = async (ctx , next ) => {
521521 try {
522522 let students = await Student .getAllAsync ();
@@ -540,7 +540,7 @@ exports.list = async (ctx, next) => {
540540
5415414.1 正常写法
542542
543- ```
543+ ``` js
544544const pkgConf = require (' pkg-conf' );
545545
546546async function main (){
@@ -555,7 +555,7 @@ main();
555555
556556变态写法
557557
558- ```
558+ ``` js
559559const pkgConf = require (' pkg-conf' );
560560
561561(async () => {
@@ -568,7 +568,7 @@ const pkgConf = require('pkg-conf');
568568
5695694.2 await + Promise
570570
571- ```
571+ ``` js
572572const Promise = require (' bluebird' );
573573const fs = Promise .promisifyAll (require (" fs" ));
574574
@@ -582,7 +582,7 @@ main();
582582
5835834.3 await + co + generator
584584
585- ```
585+ ``` js
586586const co = require (' co' );
587587const Promise = require (' bluebird' );
588588const fs = Promise .promisifyAll (require (" fs" ));
0 commit comments