This commit is contained in:
Peter Morton 2023-10-12 19:01:11 -05:00
parent b314b361b2
commit be1495d8b3
4 changed files with 17 additions and 15 deletions

View File

@ -89,9 +89,10 @@ router.all("/", (req, res, next) => {
}) })
.then(() => { .then(() => {
res.send(decoded); res.send(decoded);
}).catch((e) => { })
.catch((e) => {
logger.error(e); // "Uh-oh!" logger.error(e); // "Uh-oh!"
});; });
} catch (err) { } catch (err) {
logger.error(`Verify failed [${JSON.stringify(err, null, 2)}].`); logger.error(`Verify failed [${JSON.stringify(err, null, 2)}].`);
next(err); next(err);

View File

@ -134,7 +134,8 @@ router.get("/", async (req, res) => {
logger.debug(`Sending data: ${JSON.stringify(data, null, 2)}`); logger.debug(`Sending data: ${JSON.stringify(data, null, 2)}`);
res.send(data); res.send(data);
}).catch((e) => { })
.catch((e) => {
logger.error(e); // "Uh-oh!" logger.error(e); // "Uh-oh!"
}); });
}); });

View File

@ -1,11 +1,11 @@
export { default as logger } from "./logger.js"; export { default as logger } from "./logger.js";
export { default as store } from "./store.js"; export { default as store } from "./store.js";
export function isEmpty(obj) { export function isEmpty(obj) {
for (const prop in obj) { for (const prop in obj) {
if (Object.hasOwn(obj, prop)) { if (Object.hasOwn(obj, prop)) {
return false; return false;
}
} }
return true;
} }
return true;
}

View File

@ -1,14 +1,14 @@
import { createClient } from 'redis'; import { createClient } from "redis";
import config from "../config/index.js"; import config from "../config/index.js";
import { logger } from "./index.js"; import { logger } from "./index.js";
const client = createClient({ const client = createClient({
url: config.redis.url url: config.redis.url,
}); });
client.on('error', err => logger.error('Redis Client Error', err)); client.on("error", (err) => logger.error("Redis Client Error", err));
await client.connect(); await client.connect();
logger.info(`Connect store to ${config.redis.url}`) logger.info(`Connect store to ${config.redis.url}`);
export default client; export default client;