Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    relivepublic

    node-reload

    Auto reload apps without loss connections or sessions, good for production or development

    Installation

    $ npm install relive
    

    Example

    global.relive = require("relive")();
    var express = require('express');
    var app = express();  
     
        
    if(!relive.sessionUse) relive.sessionUse = express.session({ store: new express.session.MemoryStore()});
        
          
    app.use(express.cookieParser('<your secret here>'));
    app.use(relive.sessionUse);
    app.use(app.router);
        
    app.get("/",function(req,res){
        req.session.count = req.session.count ? req.session.count + 1 : 1;
        res.end("your count: " + req.session.count);
    });
     
    relive.app = app;
     
    if(relive.first){
        var http = require("http");
        
        http.createServer(function(){ 
            relive.app.apply(null, arguments); 
        }).listen( process.env.PORT || 80 , process.env.IP , function(){
            console.log('server listening on  %s:%s' ,process.env.IP, process.env.PORT);
        });
    }else{
        console.log("reload app");
    }

    Options

    global.relive = require("relive")(options);

    • watch array of directories OR string of directory OR boolean true -> pwd false -> disable watch (default: true)
    • watchMatch object Regex for filter change file (default: /\.(js|json)$/)
    • watchDelay delay milliseconds to reload (for many changes) (default: 1000)

    Keywords

    none

    install

    npm i relive

    Downloadslast 7 days

    0

    version

    0.2.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar