From 35e3b3b421074aa572a9f4bc53393dd3060b3ba2 Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Sat, 24 Sep 2016 12:14:27 -0700 Subject: [PATCH] Add logging middleware to log requests --- function-run/nodejs/package.json | 3 ++- function-run/nodejs/server.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/function-run/nodejs/package.json b/function-run/nodejs/package.json index fcd3f671..fb4ae26f 100644 --- a/function-run/nodejs/package.json +++ b/function-run/nodejs/package.json @@ -15,6 +15,7 @@ "dependencies": { "express": "", "minimist": "", - "body-parser": "" + "body-parser": "", + "morgan": "" } } diff --git a/function-run/nodejs/server.js b/function-run/nodejs/server.js index c2672128..ec426c69 100644 --- a/function-run/nodejs/server.js +++ b/function-run/nodejs/server.js @@ -5,6 +5,7 @@ const process = require('process'); const express = require('express'); const app = express(); const bodyParser = require('body-parser'); +const morgan = require('morgan'); // Command line opts const argv = require('minimist')(process.argv.slice(1)); @@ -48,7 +49,10 @@ function specialize(req, res) { } -app.use(bodyParser.urlencoded()); +// Request logger +app.use(morgan('combined')) + +app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.use(bodyParser.raw());