Skip to content

Commit 4e18de6

Browse files
committed
feat: updating dependencies, adding test http, using port 8080
1 parent fd41d90 commit 4e18de6

File tree

7 files changed

+89
-43
lines changed

7 files changed

+89
-43
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ COPY --from=prerelease /usr/src/app/package.json .
3737

3838
# run the app
3939
USER bun
40-
EXPOSE 3000/tcp
40+
EXPOSE 8080/tcp
4141
ENTRYPOINT [ "bun", "index.js" ]

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Next, spin up docker containers:
3232
bun docker
3333
```
3434

35-
You should have a server running on `http://localhost:<port>` where the port is set in your `.env` file (default is 3000). You can test the following routes:
35+
You should have a server running on `http://localhost:<port>` where the port is set in your `.env` file (default is 8080). You can test the following routes:
3636

3737
1. `GET /api/todos` - Gets all todos
3838
2. `GET /api/todos/:id` - Gets a todo by ID
@@ -69,6 +69,12 @@ Formatting code:
6969
bun format
7070
```
7171

72+
Updating dependencies:
73+
74+
```bash
75+
bun update
76+
```
77+
7278
## Connecting to Redis Cloud
7379

7480
If you don't yet have a database setup in Redis Cloud [get started here for free](https://redis.io/try-free/).

__tests__/Tests.http

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@Host = http://localhost:8080
2+
3+
### Get All Todos
4+
GET {{Host}}/api/todos HTTP/1.1
5+
6+
### Search Todos
7+
8+
GET {{Host}}/api/todos/search?status=in progress HTTP/1.1
9+
10+
### Get a single todo
11+
12+
GET {{Host}}/api/todos/1 HTTP/1.1
13+
14+
### Create a todo
15+
16+
POST {{Host}}/api/todos HTTP/1.1
17+
Content-Type: application/json
18+
19+
{
20+
"id": "2",
21+
"name": "Laundry"
22+
}
23+
24+
### Update a todo
25+
26+
PATCH {{Host}}/api/todos/2 HTTP/1.1
27+
Content-Type: application/json
28+
29+
{
30+
"status": "in progress"
31+
}
32+
33+
### Delete a todo
34+
35+
DELETE {{Host}}/api/todos/2 HTTP/1.1

bun.lock

+39-33
Large diffs are not rendered by default.

compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
target: dev
2121
command: bun dev
2222
ports:
23-
- 3000:3000
23+
- 8080:8080
2424
env_file:
2525
- ./.env
2626
- ./.env.docker

package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@
1111
"dev": "bun run --watch .",
1212
"format": "prettier . --write",
1313
"start": "bun .",
14-
"docker": "docker compose down && bun docker:prune && docker compose up -d",
15-
"docker:prune": "docker image prune -a -f && docker volume prune -a -f && docker builder prune -a -f"
14+
"docker": "docker compose down && docker compose up -d --build"
1615
},
1716
"dependencies": {
1817
"dotenv": "^16.4.7",
19-
"express": "^4.21.2",
18+
"express": "^5.0.1",
2019
"redis": "^4.7.0",
21-
"uuid": "^11.0.5"
20+
"uuid": "^11.1.0"
2221
},
2322
"devDependencies": {
2423
"nodemon": "^3.1.9",
25-
"prettier": "^3.4.2",
24+
"prettier": "^3.5.2",
2625
"supertest": "^7.0.0"
2726
}
2827
}

server/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import "dotenv/config";
22
import app, { initialize } from "./app.js";
33

4-
const port = process.env.PORT ?? 3000;
4+
const port = process.env.PORT ?? 8080;
55

6-
app.listen(process.env.PORT ?? 3000, async () => {
6+
app.listen(port, async () => {
77
console.log(`Redis JS starter server listening on port ${port}`);
88

99
await initialize();

0 commit comments

Comments
 (0)