Skip to content

Commit

Permalink
feat: adds docker-compose to run webapp and backend side by side (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonitienda authored Mar 21, 2024
2 parents 77ce76b + 97fa467 commit 2261d64
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.7'
services:
backend:
build:
context: ./backend-golang-rest
dockerfile: Dockerfile
ports:
- 8080:8080
webapp:
build:
context: ./webapp-react
dockerfile: Dockerfile
ports:
- 3000:3000
depends_on:
- backend
4 changes: 2 additions & 2 deletions webapp-react/src/api/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export async function getTasks() {
const res = await fetch("http://localhost:8080/v0/tasks?t=1", {
const res = await fetch("http://backend:8080/v0/tasks", {
cache: "no-store",
headers: {
"X-User-ID": "b78fe6be-0642-4cfa-9f19-9cc8e53b129d",
Expand All @@ -17,7 +17,7 @@ export async function getTasks() {
}

export async function addTask() {
const res = await fetch("http://localhost:8080/v0/tasks", {
const res = await fetch("http://backend:8080/v0/tasks", {
method: "POST",
body: JSON.stringify({
title: "New task",
Expand Down

0 comments on commit 2261d64

Please sign in to comment.