From dbb540227457a5fda8236c4a2b254cf35cb7ae1b Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 18 Feb 2019 15:36:39 -0500 Subject: [PATCH] Add logging middleware --- index.js | 4 ++-- package-lock.json | 25 +++++++++++++++++++++++++ package.json | 3 ++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 356ea93..997ac3e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ const express = require("express"); const app = express(); - +app.use(require("morgan")("dev")); // function exitHandler() { @@ -13,7 +13,7 @@ const app = express(); // }); -app.get("/", (req, res) => { +app.get("/ap", (req, res) => { res.end("Hello, world!"); }); diff --git a/package-lock.json b/package-lock.json index 739a79a..3de824c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,14 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "requires": { + "safe-buffer": "5.1.2" + } + }, "body-parser": { "version": "1.18.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", @@ -221,6 +229,18 @@ "mime-db": "~1.38.0" } }, + "morgan": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", + "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", + "requires": { + "basic-auth": "~2.0.0", + "debug": "2.6.9", + "depd": "~1.1.2", + "on-finished": "~2.3.0", + "on-headers": "~1.0.1" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -239,6 +259,11 @@ "ee-first": "1.1.1" } }, + "on-headers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", + "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=" + }, "parseurl": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", diff --git a/package.json b/package.json index 0edae28..e10a719 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { - "express": "^4.16.4" + "express": "^4.16.4", + "morgan": "^1.9.1" } }