[Node.js] Use "prestart" in scripts

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Node.js] Use "prestart" in scripts相关的知识,希望对你有一定的参考价值。

Usually we run : 

npm start

to start an app, then we we might call other script to do something:

npm build && nodemon app

 

Actaully we can use "prestart" to simpify this, because npm will check if there is "prestart" script, if there is it will run prestart before start:

"prestart": "babel src --out-dir dist",
"start": "node dist/index.js"

 

以上是关于[Node.js] Use "prestart" in scripts的主要内容,如果未能解决你的问题,请参考以下文章

node.js的路由

node.js之express中app.use

node js app.use 抛出一个中间件函数

When to use next() and return next() in Node.js

[Node.js] Use nodejs-dashboard event loop delay with hrtime()

Node.js 表达了对 bodyParser 中间件的正确使用