From db083aa4e237aa31d3437fab6589275fc84483ca Mon Sep 17 00:00:00 2001 From: Rupeshiya Date: Sat, 25 Jul 2020 10:27:55 +0530 Subject: [PATCH 1/2] intial deactivation mechanism --- app/controllers/auth.js | 3 --- app/controllers/event.js | 1 - app/controllers/notification.js | 1 - app/controllers/organization.js | 2 -- app/controllers/proposal.js | 2 -- app/controllers/user.js | 13 ++++++++++++- app/routes/user.js | 8 ++++++++ 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/controllers/auth.js b/app/controllers/auth.js index 744c8dc..20f101f 100644 --- a/app/controllers/auth.js +++ b/app/controllers/auth.js @@ -9,9 +9,6 @@ module.exports = { const token = await user.generateAuthToken() res.send({ user: user, token: token }) } catch (error) { - if (process.env.NODE_ENV !== 'production') { - console.log(error.name, '-', error.message) - } res.status(HttpStatus.BAD_REQUEST).json({ error: error.message }) } }, diff --git a/app/controllers/event.js b/app/controllers/event.js index dd4c4eb..ebc17fa 100644 --- a/app/controllers/event.js +++ b/app/controllers/event.js @@ -176,7 +176,6 @@ module.exports = { const events = await Event.find({ eventDate: { $gt: Date.now() } }, {}, helper.paginate(req)) .sort({ eventDate: -1 }) .exec() - console.log('Upcoming events ', events) return res.status(HttpStatus.OK).json({ events }) } catch (error) { HANDLER.handleError(res, next) diff --git a/app/controllers/notification.js b/app/controllers/notification.js index 96147b4..7fd4027 100644 --- a/app/controllers/notification.js +++ b/app/controllers/notification.js @@ -46,7 +46,6 @@ module.exports = { getProposalNotifications: async (req, res, next) => { try { const notifications = await ProposalNotifications.find({}) - console.log(notifications) return res.status(HttpStatus.OK).json({ notifications }) } catch (error) { HANDLER.handleError(res, error) diff --git a/app/controllers/organization.js b/app/controllers/organization.js index 39cd176..4747698 100644 --- a/app/controllers/organization.js +++ b/app/controllers/organization.js @@ -208,7 +208,6 @@ module.exports = { .json({ msg: 'No Organization found!' }) } const updates = Object.keys(req.body) - console.log('req.body ', req.body) const allowedUpdates = ['settings', 'permissions', 'authentication'] // if admin then check if valid update if (req.user.isAdmin === true) { @@ -307,7 +306,6 @@ module.exports = { // console.log('Permitted to removeAdmin') // REMOVE ADMINS FROM ADMINS LIST const admins = org.adminInfo.adminId - console.log('adminIds ', admins) const removableIndex = admins.indexOf(userId) if (removableIndex === -1) { return res diff --git a/app/controllers/proposal.js b/app/controllers/proposal.js index d550cf1..3aab6bb 100644 --- a/app/controllers/proposal.js +++ b/app/controllers/proposal.js @@ -131,7 +131,6 @@ module.exports = { try { const proposalId = req.body.proposalId - console.log(proposalId) const result = await ProposalModel.findByIdAndDelete(proposalId) const creator = result.creator @@ -214,7 +213,6 @@ module.exports = { }, getAllProposals: async (req, res, next) => { - console.log('All proposals called') try { const proposals = await ProposalModel.find({}) if (!proposals.length) { diff --git a/app/controllers/user.js b/app/controllers/user.js index 5bfa7de..c433228 100644 --- a/app/controllers/user.js +++ b/app/controllers/user.js @@ -63,7 +63,8 @@ module.exports = { const allowedUpdates = [ 'phone', 'info', - 'about' + 'about', + 'isDeactivated' ] // added control as per org settings if (settingHelper.canChangeName()) { @@ -419,5 +420,15 @@ module.exports = { } catch (error) { HANDLER.handleError(res, error) } + }, + // DEACTIVATE ACCOUNT (BY USER ITSELF) + deactivateAccount: async (req, res, next) => { + try { + req.user.isActivated = !req.user.isActivated + const user = await req.user.save() + return res.status(HttpStatus.OK).json({ user }) + } catch (error) { + HANDLER.handleError(error) + } } } diff --git a/app/routes/user.js b/app/routes/user.js index 0c9be6e..ee6f609 100644 --- a/app/routes/user.js +++ b/app/routes/user.js @@ -130,4 +130,12 @@ router.patch( userController.removeUser ) +// DEACTIVATE ACCOUNT BY USER +router.patch( + '/deactivate/toggler', + isUnderMaintenance, + auth, + userController.deactivateAccount +) + module.exports = router From 5b06ce75a40d70350e613e0c552f92b7a558c2bd Mon Sep 17 00:00:00 2001 From: Rupeshiya Date: Sat, 25 Jul 2020 12:13:47 +0530 Subject: [PATCH 2/2] intial logging mechanism and deactive account --- app.js | 21 ++++- app/controllers/user.js | 11 --- app/middleware/auth.js | 2 +- config/winston.js | 71 +++++++++++++++ package-lock.json | 192 ++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- 6 files changed, 286 insertions(+), 15 deletions(-) create mode 100644 config/winston.js diff --git a/app.js b/app.js index 2acb3b4..f32a335 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ require('./config/mongoose') const express = require('express') -const logger = require('morgan') +const morgan = require('morgan') const cookieParser = require('cookie-parser') const createError = require('http-errors') const path = require('path') @@ -8,6 +8,7 @@ const socket = require('socket.io') const multer = require('multer') const bodyParser = require('body-parser') const cors = require('cors') +var winston = require('./config/winston') const fileConstants = require('./config/fileHandlingConstants') const indexRouter = require('./app/routes/index') @@ -47,7 +48,17 @@ io.on('connection', (socket) => { app.set('views', path.join(__dirname, 'views')) app.set('view engine', 'ejs') -app.use(logger('tiny')) +morgan.token('data', (req, res) => { + return JSON.stringify(req.body) +}) + +app.use( + morgan( + ':remote-addr - :remote-user [:date[clf]] ":method :url" :status :res[content-length] ":referrer" ":user-agent" :data', + { stream: winston.stream } + ) +) + app.use(express.json()) app.use(express.urlencoded({ extended: false })) app.use(cookieParser()) @@ -80,9 +91,15 @@ app.use(function (err, req, res, next) { res.locals.message = err.message res.locals.error = req.app.get('env') === 'development' ? err : {} + // To include winston logging (Error) + winston.error( + `${err.status || 500} - ${err.message} - ${req.originalUrl} - ${req.method} - ${req.ip} - ${req.body}` + ) + // render the error page res.status(err.status || 500) res.render('error') + // Socket event error handler (On max event) req.io.on('error', function (err) { console.error('------REQ ERROR') diff --git a/app/controllers/user.js b/app/controllers/user.js index c433228..8b3303a 100644 --- a/app/controllers/user.js +++ b/app/controllers/user.js @@ -40,7 +40,6 @@ module.exports = { await emailController.sendEmail(req, res, next, token) return res.status(HttpStatus.CREATED).json({ user: user, token: token }) } catch (error) { - console.log(error) return res.status(HttpStatus.NOT_ACCEPTABLE).json({ error: error }) } }, @@ -104,9 +103,6 @@ module.exports = { await user.save() return res.status(HttpStatus.OK).json({ success: true, token }) } catch (error) { - if (process.env.NODE_ENV !== 'production' && error) { - console.log('Error in forgotPasswordRequest ', error) - } return res.status(HttpStatus.BAD_REQUEST).json({ error }) } }, @@ -136,15 +132,9 @@ module.exports = { notificationHelper.addToNotificationForUser(id, res, notification, next) return res.status(HttpStatus.OK).json({ updated: true }) } else { - if (process.env.NODE_ENV !== 'production') { - console.log('token expired') - } res.status(HttpStatus.BAD_REQUEST).json({ error: 'Token expired' }) } } catch (error) { - if (process.env.NODE_ENV !== 'production' && error) { - console.log('Something went wrong ', error) - } res.status(HttpStatus.BAD_REQUEST).json({ error }) } }, @@ -375,7 +365,6 @@ module.exports = { if (user.isAdmin === true) { const blockedIds = user.blocked.map(item => item._id) const unblockIndex = blockedIds.indexOf(id) - console.log('UnblockIndex ', unblockIndex) if (unblockIndex !== -1) { user.blocked.splice(unblockIndex, 1) await user.save() diff --git a/app/middleware/auth.js b/app/middleware/auth.js index 67c266c..58bca4a 100644 --- a/app/middleware/auth.js +++ b/app/middleware/auth.js @@ -32,7 +32,7 @@ const auth = async (req, res, next) => { 'isAdmin' ]) .exec() - console.log(user) + // console.log(user) if (!user) { throw new Error() diff --git a/config/winston.js b/config/winston.js new file mode 100644 index 0000000..021d62d --- /dev/null +++ b/config/winston.js @@ -0,0 +1,71 @@ +var appRoot = require('app-root-path') +var winston = require('winston') + +const { combine, colorize, printf, timestamp } = winston.format + +const logFormat = printf((info) => { + return `[${info.timestamp}] ${info.level}: ${info.message}` +}) + +const rawFormat = printf((info) => { + return `[${info.timestamp}] ${info.level}: ${info.message}` +}) + +// define the custom settings for each transport (file, console) +var options = { + file: { + level: 'info', + filename: `${appRoot}/logs/app.log`, + handleExceptions: true, + json: true, + maxsize: 5242880, // 5MB + maxFiles: 5, + colorize: false + }, + errorFile: { + level: 'error', + name: 'file.error', + filename: `${appRoot}/logs/error.log`, + handleExceptions: true, + json: true, + maxsize: 5242880, // 5MB + maxFiles: 100, + colorize: true + }, + console: { + level: 'debug', + handleExceptions: true, + json: false, + format: combine(colorize(), rawFormat) + } +} + +// instantiate a new Winston Logger with the settings defined above +var logger = winston.createLogger({ + format: combine( + timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), + logFormat + ), + transports: [ + new winston.transports.File(options.file), + new winston.transports.Console(options.console) + ], + exitOnError: false // do not exit on handled exceptions +}) + +// create a stream object with a 'write' function that will be used by `morgan` +logger.stream = { + write: function (message, encoding) { + // use the 'info' log level so the output will be picked up by both transports (file and console) + logger.info(message) + } +} + +winston.addColors({ + debug: 'white', + error: 'red', + info: 'green', + warn: 'yellow' +}) + +module.exports = logger diff --git a/package-lock.json b/package-lock.json index 02e7a11..a8ef638 100644 --- a/package-lock.json +++ b/package-lock.json @@ -210,6 +210,16 @@ } } }, + "@dabh/diagnostics": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", + "integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==", + "requires": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "@jest/console": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", @@ -708,6 +718,11 @@ } } }, + "app-root-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.0.0.tgz", + "integrity": "sha512-qMcx+Gy2UZynHjOHOIXPNvpf+9cjvk3cWrBBK7zg4gH9+clobJRb9NGzcT7mQTcV/6Gm/1WelUtqxVXnNlrwcw==" + }, "append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -819,6 +834,11 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, + "async": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" + }, "async-each": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", @@ -1512,6 +1532,15 @@ "object-visit": "^1.0.0" } }, + "color": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -1525,6 +1554,29 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, + "color-string": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "colorspace": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.2.tgz", + "integrity": "sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==", + "requires": { + "color": "3.0.x", + "text-hex": "1.0.x" + } + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1967,6 +2019,11 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -2952,6 +3009,11 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, "fb-watchman": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", @@ -2961,6 +3023,11 @@ "bser": "^2.0.0" } }, + "fecha": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.0.tgz", + "integrity": "sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg==" + }, "figures": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", @@ -3053,6 +3120,11 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "follow-redirects": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", @@ -5308,6 +5380,11 @@ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true }, + "kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "latest-version": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", @@ -5408,6 +5485,25 @@ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, + "logform": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.2.0.tgz", + "integrity": "sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg==", + "requires": { + "colors": "^1.2.1", + "fast-safe-stringify": "^2.0.4", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "triple-beam": "^1.3.0" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -6063,6 +6159,14 @@ "wrappy": "1" } }, + "one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "requires": { + "fn.name": "1.x.x" + } + }, "onetime": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", @@ -6980,6 +7084,21 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + } + } + }, "sisteransi": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.4.tgz", @@ -7378,6 +7497,11 @@ "tweetnacl": "~0.14.0" } }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, "stack-utils": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", @@ -7662,6 +7786,11 @@ "require-main-filename": "^2.0.0" } }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -7798,6 +7927,11 @@ "punycode": "^2.1.0" } }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", @@ -8210,6 +8344,64 @@ } } }, + "winston": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.3.3.tgz", + "integrity": "sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==", + "requires": { + "@dabh/diagnostics": "^2.0.2", + "async": "^3.1.0", + "is-stream": "^2.0.0", + "logform": "^2.2.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.4.0" + }, + "dependencies": { + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "winston-transport": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.4.0.tgz", + "integrity": "sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw==", + "requires": { + "readable-stream": "^2.3.7", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", diff --git a/package.json b/package.json index 87a60d8..55e9bb6 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@sendgrid/mail": "^7.0.0", + "app-root-path": "^3.0.0", "aws-sdk": "^2.691.0", "bcrypt": "^3.0.6", "body-parser": "^1.19.0", @@ -28,7 +29,8 @@ "morgan": "^1.9.1", "multer": "^1.4.2", "socket.io": "^2.3.0", - "validator": "^10.11.0" + "validator": "^10.11.0", + "winston": "^3.3.3" }, "jest": { "testEnvironment": "node",