From 5636edd5b6af3486284b430f660b1b9e309a3671 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Fri, 20 Oct 2023 23:37:28 -0400 Subject: Bring it all together and nitpick the appearance --- utils.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'utils.js') diff --git a/utils.js b/utils.js index eefc84d..695063f 100644 --- a/utils.js +++ b/utils.js @@ -1,7 +1,9 @@ const path = require('path'); const config = require('./config.js'); +const slugUtils = require('./static/js/slug.js'); const helperFunctions = { + generateSlug : slugUtils.generateSlug, sendFile : function (res, fileName) { res.sendFile(fileName, { root: path.join(__dirname) @@ -23,9 +25,10 @@ const helperFunctions = { }); }, sendBadRequestError : function (res, errorMessage) { - res.status(400).json({status: "ERROR", statusCode: 400, errorType: "BAD REQUEST", errorMessage}); + res.status(400).json({status: "ERROR", statusCode: 400, errorType: "BAD REQUEST", errorMessage, uiString: "Already Exists"}); }, - sendInternalServerError : function (res) { + sendInternalServerError : function (res, error) { + console.error('[express] Error:', error); res.status(404).json({status: "ERROR", statusCode: 500, errorType: "INTERNAL", errorMessage: "Internal Server Error"}); }, sendSuccessfulSlugCreation : function (res, slug) { -- cgit v1.2.3