1.2.5 • Published 9 years ago

node-noginx v1.2.5

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

noginx

Build Status

It's a cache proxy middleware like logical nginx of node.js with expressjs.

Install

npm install node-noginx --save

Usage

app.use(noginx([ < RegExp > , {
    rule: < RegExp > , // route match rule
    maxAge: < Number > , // ms, the cache data expired time
    keyQueries: [ < String > , < String > ], // picking params of query as cache-key
    timeout: < Number >, //  ms, max waitting time when cache unhit
    gzip: < Boolean > // disable gzip or not
}]), {
    maxAge: 3 * 1000, // ms, default 3000
    maxQueueSize: 5000, // max request watting queue size, default 5000, it will responce 503 when queue is full 
    maxCache: 5000, // default 5000
    cacheFreePercent: < Float >, // free percentage of maxCache when cache is overflow 
    timeout: 100, // ms, default 500
    debug: < Boolean >, // whether log debug info
    logger: < Function > // Log function
})

Test

npm test

Doc

Proxy method

  • res.render

    	**override:** 
    
    		- res.render(tpl, data)
  • res.send

    	**override:** 
    
    		- res.render(statusCode, body)
    		- res.render(statusCode)
    		- res.render(body)
  • res.json

    override:

    		- res.json(obj)
  • res.redirect

    override:

      - res.redirect(url)

Proxy headers

  • Content-Type
  • Cache-Control

License

MIT

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.19

9 years ago

1.1.18

9 years ago

1.1.17

9 years ago

1.1.16

9 years ago

1.1.15

9 years ago

1.1.14

9 years ago

1.1.13

9 years ago

1.1.12

9 years ago

1.1.11

9 years ago

1.1.10

9 years ago

1.1.9

9 years ago

1.1.8

9 years ago

1.1.7

9 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago