From 46414e0a7b05758c69b28530121699ea1faedbf3 Mon Sep 17 00:00:00 2001 From: Glowstudent777 <55334764+Glowstudent777@users.noreply.github.com> Date: Sun, 26 Jan 2025 14:15:50 -0600 Subject: [PATCH] Fix some logging --- README.md | 11 ++++++++++- docker-compose.yml | 7 ------- docker-redis.yml | 5 ----- src/api/v1/votd/index.ts | 6 ++++-- 4 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 docker-redis.yml diff --git a/README.md b/README.md index a780a7e..bbca4e4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ Express Rest API for getting verses and such from YouVersion. +# Cloning + +Because this project uses submodules, you'll need to clone it with the `--recurse` flag. + +```bash +git clone --recurse https://github.com/Glowstudent777/YouVersion-API.git && cd YouVersion-API +``` + # Building and Running > **Note** @@ -9,7 +17,7 @@ Express Rest API for getting verses and such from YouVersion. First step is of course installing the modules -``` +```bash pnpm i ``` @@ -80,6 +88,7 @@ A good API call responds with a `200 OK` and the requested verse(s).
Checking the API status is pretty simple, just make a request to the following route and if everything is fine it'll respond with a `200 OK` and no JSON object. + ``` https://serverAddress.com/api/v1/status ``` diff --git a/docker-compose.yml b/docker-compose.yml index b5a3520..c43d286 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,13 +4,6 @@ services: ports: - "3000:3000" - redis: - image: redis/redis-stack-server:latest - networks: - - dokploy-network - expose: - - "6379" - networks: dokploy-network: external: true diff --git a/docker-redis.yml b/docker-redis.yml deleted file mode 100644 index c441a7e..0000000 --- a/docker-redis.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: - redis: - image: redis/redis-stack-server:latest - ports: - - "6379:6379" diff --git a/src/api/v1/votd/index.ts b/src/api/v1/votd/index.ts index 1850883..868b0ff 100644 --- a/src/api/v1/votd/index.ts +++ b/src/api/v1/votd/index.ts @@ -34,7 +34,8 @@ router.get("/", async (req: Request, res: Response) => { try { getFromCache("votd", async (err, data) => { if (data) { - console.log("Verse of the day fetched from Redis"); + if (process.env.NODE_ENV === "development") + console.log("Verse of the day fetched from Memory"); res.status(200).send(JSON.parse(data)); } else { const lang = (req.query.lang as string) || "en"; @@ -42,7 +43,8 @@ router.get("/", async (req: Request, res: Response) => { setToCache("votd", JSON.stringify(data), getVotdExpireTime()); - console.log("Verse of the day fetched from API"); + if (process.env.NODE_ENV === "development") + console.log("Verse of the day fetched from API"); res.status(200).send(data); } });