Browse Source

Add an access log middleware.

middleware/access_log.js, package.json
	-Add middleware for printing out access logs.
	-Add necessary dependencies.
pull/123/head
Severyn Kozak 10 years ago
parent
commit
877e1e90a5
  1. 2
      app.js
  2. 14
      middleware/access_log.js
  3. 2
      package.json

2
app.js

@ -1,6 +1,8 @@
var app = require('express')();
app.use( require( './middleware/access_log' ) );
/** ----------------------- middleware ----------------------- **/
app.use( require('./middleware/headers') );

14
middleware/access_log.js

@ -0,0 +1,14 @@
/**
* Print out access logs.
*/
'use strict';
var peliasConfig = require( 'pelias-config' ).generate().api;
var morgan = require( 'morgan' );
module.exports = peliasConfig.accessLog ?
morgan( peliasConfig.accessLog ) :
function noop(req, res, next){
next();
};

2
package.json

@ -41,6 +41,8 @@
"is-object": "^1.0.1",
"markdown": "0.5.0",
"pelias-esclient": "0.0.25",
"morgan": "1.5.2",
"pelias-config": "^0.1.4",
"pelias-suggester-pipeline": "2.0.2"
},
"devDependencies": {

Loading…
Cancel
Save