accesses
v2.5.0
Published
HTTP request logger middleware
Downloads
17
Readme
A graphical access logger for Node.
Features
Install
$ npm install accesses --save
Usage
Init accesses
import Accesses from 'accesses';
// Set up
const accesses = new Accesses({
appName: 'My Web Service',
port: 616
});
Register accesses to a framework as a middleware
express
import * as express from 'express';
const app = express();
// Register as a middleware
app.use(accesses.express);
app.get('/', (req, res) => {
res.send('yeah');
});
app.listen(80);
If you use the cluster...
You must be call master
function at master process. e.g.:
import * as cluster from 'cluster';
import { master } from 'accesses';
// Master
if (cluster.isMaster) {
// your master code
// Call master function
master();
}
// Workers
else {
// your worker code
}
That is it.
Now, we can monitor accesses on localhost:616
Intercept requests
accesses can intercept to request. So, you can hold, drop and bypass a request and send a custom resoponse.
When turn on intercepting mode, all requests will hold.
Reference
options
| Property | Type | Description | | ------------ | -------- | -------------------------------- | | appName | string | Your app name | | port | number | Port number that you want listen | | store | Store | todo |
Contribution
Issue reports, feature requests and pull requests are welcome!