Skip to content

Commit

Permalink
Fix some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Glowstudent777 committed Jan 26, 2025
1 parent 67dad0c commit 46414e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

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**
> I use `pnpm` in these examples. `NPM` will also work if you don't have or want to install `pnpm`
First step is of course installing the modules

```
```bash
pnpm i
```

Expand Down Expand Up @@ -80,6 +88,7 @@ A good API call responds with a `200 OK` and the requested verse(s).
<br>

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
```
Expand Down
7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions docker-redis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions src/api/v1/votd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ 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";
const data = await getVotd(lang);

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);
}
});
Expand Down

0 comments on commit 46414e0

Please sign in to comment.