Skip to content

Commit

Permalink
Added vercel.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Pudi-Sravan committed Jul 4, 2024
1 parent 3649287 commit e410110
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 32 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
./node_modules
src/Back_end/node_modules
src/Back_end/node_modules
.env
src/Back_end/.env
.git
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.8'

services:
frontend:
image: slack-clone/frontend
build:
context: .
dockerfile: dockerfile-frontend
Expand All @@ -14,6 +15,7 @@ services:
- backend

backend:
image: slack-clone/backend
build:
context: .
dockerfile: dockerfile-backend
Expand Down
6 changes: 3 additions & 3 deletions dockerfile-backend
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ COPY src/Back_end/package.json .
COPY src/Back_end/package-lock.json .

# Install all dependencies including devDependencies
RUN npm install --production=false
RUN npm install --production=true

# Copy the rest of the backend application code
COPY src/Back_end .

# Copy backend-specific .env file (if needed)
COPY src/Back_end/.env .
#COPY src/Back_end/.env .

# Expose the port on which the backend server will run
EXPOSE 3000
EXPOSE 10000

# Command to start the backend server
CMD ["npm", "run", "start"]
9 changes: 4 additions & 5 deletions dockerfile-frontend
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ WORKDIR /app
COPY package.json .
COPY package-lock.json .

# Install all dependencies including devDependencies
RUN npm install --production=false
# Install all dependencies including production only
RUN npm install --production

# Copy the rest of the frontend application code
COPY src/Front_end ./src/Front_end

# Copy frontend-specific files
COPY ./.env .
COPY vite.config.js .
COPY index.html .

# Expose the port on which the frontend server will run
EXPOSE 5172
EXPOSE 5173

# Command to start the frontend server
CMD ["npm", "run", "dev"]
CMD ["npm", "run", "build"]
3 changes: 2 additions & 1 deletion src/Back_end/Routes/apiroutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { google } = require("googleapis");
const calendar = google.calendar("v3");
require("dotenv").config();
router.use(express.json());
console.log(process.env.Front_endURL)
const client = new google.auth.OAuth2(
process.env.CLIENT_ID,
process.env.CLIENT_SECRET,
Expand Down Expand Up @@ -84,7 +85,7 @@ router.get("/googleauth/redirect", async (req, res) => {
const { tokens } = await client.getToken(code);
client.setCredentials(tokens);
req.session.tokens = tokens;
res.redirect("http://localhost:5172");
res.redirect(process.env.Front_endURL);
} catch (error) {
console.error("Error handling OAuth2 redirect:", error);
res.status(500).send("Error handling OAuth2 redirect");
Expand Down
2 changes: 1 addition & 1 deletion src/Front_end/Authentication/loginpage/loginbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Login({ settoken, setUpdload }) {
let { data, error } = await supabase.auth.signInWithOAuth({
provider: provider,
options: {
redirectTo: window.location.origin + "/update-details", // Redirect to update-details after login
redirectTo: "https://slack-clone-3gvixgrvr-pudi-sravans-projects.vercel.app/" + "/update-details", // Redirect to update-details after login
},
});
if (data) {
Expand Down
2 changes: 1 addition & 1 deletion src/Front_end/Authentication/register/register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Register({ settoken }) {
let { data, error } = await supabase.auth.signInWithOAuth({
provider: provider,
options: {
redirectTo: window.location.origin + "/update-details", // Redirect to update-details after login
redirectTo: "https://slack-clone-3gvixgrvr-pudi-sravans-projects.vercel.app/" + "/update-details", // Redirect to update-details after login
},
});
if (data) {
Expand Down
4 changes: 2 additions & 2 deletions src/Front_end/Mailing/mailsender.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ const TodoListChanges = () => {
!mailbool
) {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down
4 changes: 2 additions & 2 deletions src/Front_end/homepage/ToDo_list/assigntask.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ const Assigntask = () => {
await insert_taskid(task_id);
try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down
4 changes: 2 additions & 2 deletions src/Front_end/homepage/channels/addchannelmember.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ const Addmember = () => {
console.log("mem update successful");
try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down
4 changes: 2 additions & 2 deletions src/Front_end/homepage/channels/channelchat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ export const Channelchats = () => {
) {
try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down
12 changes: 6 additions & 6 deletions src/Front_end/homepage/channels/membersofchannel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ const Showmembers = () => {

try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down Expand Up @@ -382,8 +382,8 @@ const Showmembers = () => {

try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down Expand Up @@ -451,8 +451,8 @@ const Showmembers = () => {
if (memresult) {
try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/sendUserEmail`,
{
method: "POST",
Expand Down
10 changes: 5 additions & 5 deletions src/Front_end/homepage/googlecalendar.jsx/googlecalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const Googlecalendar = () => {
}

const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/events?timeMin=${encodeURIComponent(
timeMin
)}&timeMax=${encodeURIComponent(timeMax)}`
Expand All @@ -112,7 +112,7 @@ const Googlecalendar = () => {
const handleAddEvent = async (eventData) => {
try {
const response = await fetch(
`http://localhost:${import.meta.env.VITE_Backend_Port}/api/createEvent`,
`${import.meta.env.VITE_Backend_URL}/api/createEvent`,
{
method: "POST",
headers: {
Expand All @@ -138,8 +138,8 @@ const Googlecalendar = () => {
const handleDeleteEvent = async (eventId) => {
try {
const response = await fetch(
`http://localhost:${
import.meta.env.VITE_Backend_Port
`${
import.meta.env.VITE_Backend_URL
}/api/eventsdelete/${eventId}`,
{
method: "DELETE",
Expand Down
2 changes: 1 addition & 1 deletion src/Front_end/homepage/homepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function Home(data) {
const calendarAuth = async () => {
try {
const response = await fetch(
`http://localhost:${import.meta.env.VITE_Backend_Port}/api/googleauth`,
`${import.meta.env.VITE_Backend_URL}/api/googleauth`,
{
method: "GET",
headers: {
Expand Down
6 changes: 6 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"rewrites":[
{
"source":"/(.*)",
"destination":"/"
}
]}
5 changes: 5 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ export default defineConfig({
"/src/main.jsx": "/src/Front_end/main.jsx",
},
},
server:{
host:true,
strictPort:true,
port:5173
}
});

0 comments on commit e410110

Please sign in to comment.