最近两天时间撸了个 hotstart。@crystaldust 到底是不是热启动呢,还请大牛指点。
安装
npm install hotstart --save
警告
不要在app.js里用app.listen,也就是别自做聪明把bin/www 和 app.js 合一块。
设置
var express = require('express');
var app = express();
var hotstart = require('hotstart');
app.use(hotstart({
  dir: __dirname,  //必须
  handle: '/app.js',  
  ignore:['/public','/node_modules'], //忽略的目录 。如果 view cache 为 false,将还会忽略掉view path
  suffix:['.js'],  //过滤的后缀  如果 view cache 为 true, if view cache true,将还会忽略掉 view engine
  route: '/hotstart', // 简单的外部路由
  tpl: 'jade',  //模版缓存清理,目前只只持 jade ,EJS 
}, app));
//要是你项目是用express自动生成的,那你需要设置:
app.use(hotstart({dir:__dirname, tpl:'jade'},app));
启动,然后改动一些东西,在浏览器打开,比如: http://127.0.0.1:3000/hotstart
 
    