Skip to content

Commit

Permalink
https calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-nagaraj committed Sep 1, 2024
1 parent c4b9388 commit 5e403ad
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/pages/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const Chat = () => {
} else {
fetchUserChat();
// const newSocket = io("http://localhost:3000");
const newSocket = io("http://65.2.83.179:3000");
const newSocket = io("https://we-chat-rho.vercel.app/socket");
setSocket(newSocket);
return () => newSocket.disconnect();
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/interceptor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";

// export const baseUrl = "http://localhost:5000/api";
export const baseUrl = "http://65.2.83.179:5000/api";
export const baseUrl = "https://we-chat-rho.vercel.app/server/api";

const axiosInstance = axios.create({
baseURL: baseUrl,
Expand Down
12 changes: 12 additions & 0 deletions client/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"rewrites": [
{
"source": "/api/server/:path*",
"destination": "http://65.2.83.179:5000/api/:path*"
},
{
"source": "/socket/:path*",
"destination": "http://65.2.83.179:3000/:path*"
}
]
}
7 changes: 4 additions & 3 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ app.use((req, res, next) => {
next();
});

app.get('/health', (req, res) => {
res.status(200).send('Server is running');
});

app.use('/api/users', userRouter);

//verify token: only below routes are protected
Expand All @@ -31,9 +35,6 @@ app.use(authenticateToken);
app.use('/api/chats', chatRouter);
app.use('/api/messages', messageRouter);

app.get('/health', (req, res) => {
res.status(200).send('Server is running');
});

app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
Expand Down

0 comments on commit 5e403ad

Please sign in to comment.