Skip to content

Commit d25aa04

Browse files
committed
Expose chat-app container to localhost for development
1 parent 6dc2cfb commit d25aa04

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

backend/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ services:
108108
container_name: chat-app
109109
networks:
110110
- backend-net
111+
ports:
112+
- "8000:8000"
111113
depends_on:
112114
- cassandra-node1
113115

backend/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func main() {
112112
mux.HandleFunc("/refresh", middleware.AddCorsHeaders(auth.RefreshAccessTokenHandler))
113113

114114
go func() {
115-
log.Println("Starting HTTPS server on https://127.0.0.1:8000")
116-
log.Fatal(srv.ListenAndServeTLS("full-cert.crt", "private-key.key"))
115+
// log.Fatal(srv.ListenAndServeTLS("full-cert.crt", "private-key.key"))
116+
log.Fatal(srv.ListenAndServe())
117117
}()
118118

119119
wg.Wait()

frontend/app/components/CreateCircleModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function CreateCircleModal({ isOpen, setOpen }: CreateCircleModalProps) {
2323
name: circleName
2424
};
2525
const token = await getAccessToken();
26-
fetch('https://127.0.0.1:8000/api/circles', {
26+
fetch('http://localhost:8000/api/circles', {
2727
method: 'POST',
2828
headers: {
2929
'Authorization': `Bearer ${token}`,

frontend/app/components/InviteModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function InviteModal({ isOpen, setOpen, circleId }: InviteModalProps) {
2626
const body = {
2727
circle_id: circleId,
2828
};
29-
fetch('https://127.0.0.1:8000/api/circles/invite', {
29+
fetch('http://localhost:8000/api/circles/invite', {
3030
method: 'POST',
3131
headers: headers,
3232
body: JSON.stringify(body),
@@ -76,7 +76,7 @@ function InviteModal({ isOpen, setOpen, circleId }: InviteModalProps) {
7676
users: invitedUsers,
7777
};
7878
console.log(body);
79-
fetch('https://127.0.0.1:8000/api/circles/invite/add', {
79+
fetch('http://localhost:8000/api/circles/invite/add', {
8080
method: 'POST',
8181
headers: headers,
8282
body: JSON.stringify(body),

frontend/app/components/Login.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ export default function Login() {
1818
if (validator.isEmail(loginData.email) &&
1919
loginData.password !== ""
2020
) {
21-
fetch('https://127.0.0.1:8000/api/login', {
21+
fetch('http://localhost:8000/api/login', {
2222
method: 'POST',
2323
headers: {
2424
'Content-Type': 'application/json'
2525
},
26+
credentials: 'include',
2627
body: JSON.stringify(loginData),
2728
})
2829
.then(response => response.json())

frontend/app/components/Register.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ export default function Register() {
3737
validator.isEmail(registerData.email) &&
3838
passwordMatch == false
3939
) {
40-
fetch('https://127.0.0.1:8000/api/register', {
40+
fetch('http://localhost:8000/api/register', {
4141
method: 'POST',
4242
headers: {
4343
'Content-Type': 'application/json'
4444
},
45+
credentials: 'include',
4546
body: JSON.stringify(registerData),
4647
})
4748
.then(async (response) => {

frontend/app/context/authContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
2929

3030
async function refreshAccessToken(): Promise<string> {
3131
try {
32-
const response = await fetch("https://127.0.0.1:8000/refresh", {
32+
const response = await fetch("http://localhost:8000/refresh", {
3333
method: "POST",
3434
credentials: "include",
3535
});

frontend/app/hooks/useFetchDashboard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function useFetchDashboard(setCircles: React.Dispatch<React.SetStateActio
1818
const headers = {
1919
"Authorization": `Bearer ${token}`,
2020
};
21-
fetch('https://127.0.0.1:8000/api/user', {
21+
fetch('http://localhost:8000/api/user', {
2222
method: 'GET',
2323
headers: headers,
2424
})
@@ -44,7 +44,7 @@ export function useFetchDashboard(setCircles: React.Dispatch<React.SetStateActio
4444
const headers = {
4545
"Authorization": `Bearer ${token}`,
4646
};
47-
fetch('https://127.0.0.1:8000/api/circles', {
47+
fetch('http://localhost:8000/api/circles', {
4848
method: 'GET',
4949
headers: headers,
5050
})
@@ -77,7 +77,7 @@ export function useFetchDashboard(setCircles: React.Dispatch<React.SetStateActio
7777
async function handleDelete(circleID: string) {
7878
const token = await getAccessToken();
7979
try {
80-
const response = await fetch(`https://127.0.0.1:8000/api/circles/delete/${circleID}`, {
80+
const response = await fetch(`http://localhost:8000/api/circles/delete/${circleID}`, {
8181
method: 'DELETE',
8282
headers: {
8383
"Authorization": `Bearer ${token}`,

0 commit comments

Comments
 (0)