pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/codeCraft-Ritik/Elevate-AI/commit/441e56fbb66142bc70260902a1b0f4f921825773

Update Render URLs and fix mobile responsiveness · codeCraft-Ritik/Elevate-AI@441e56f · GitHub
Skip to content

Commit 441e56f

Browse files
Update Render URLs and fix mobile responsiveness
1 parent 138fdc2 commit 441e56f

2 files changed

Lines changed: 27 additions & 29 deletions

File tree

backend/server.js

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
1-
import express from 'express';
2-
import cors from 'cors';
3-
import helmet from 'helmet';
4-
import dotenv from 'dotenv';
5-
import { config } from './config/index.js';
6-
import connectDB from './config/db.js';
7-
import { errorHandler } from './middleware/errorMiddleware.js';
1+
const express = require('express');
2+
const cors = require('cors');
3+
const connectDB = require('./config/db');
4+
const { errorHandler } = require('./middleware/errorMiddleware');
5+
const authRoutes = require('./routes/auth');
6+
const resumeRoutes = require('./routes/resume');
7+
const contentRoutes = require('./routes/content');
8+
const analyticsRoutes = require('./routes/analytics');
89

9-
// Import Routes
10-
import authRoutes from './routes/auth.js';
11-
import contentRoutes from './routes/content.js';
12-
import resumeRoutes from './routes/resume.js';
13-
import analyticsRoutes from './routes/analytics.js';
10+
const app = express();
1411

15-
dotenv.config();
12+
// CONNECT DATABASE
1613
connectDB();
1714

18-
const app = express();
19-
20-
app.use(express.json({ limit: '50mb' }));
21-
app.use(express.urlencoded({ limit: '50mb', extended: true }));
15+
// MIDDLEWARE
16+
app.use(express.json());
2217

23-
app.use(helmet());
18+
// UPDATED CORS LOGIC: Added your specific Render URL
2419
app.use(cors({
25-
origen: "http://localhost:5173",
20+
origen: [
21+
"http://localhost:5173",
22+
"https://elevate-ai-2.onrender.com",
23+
"https://elevate-ai-2.onrender.com/"
24+
],
2625
credentials: true
2726
}));
2827

29-
// API Routes
28+
// ROUTES
3029
app.use('/api/auth', authRoutes);
31-
app.use('/api/content', contentRoutes);
3230
app.use('/api/resume', resumeRoutes);
31+
app.use('/api/content', contentRoutes);
3332
app.use('/api/analytics', analyticsRoutes);
3433

34+
// ERROR HANDLER
3535
app.use(errorHandler);
3636

37-
app.listen(config.port, () => {
38-
console.log(`🚀 Server running in ${config.env} mode on port ${config.port}`);
39-
console.log(`🔗 Shadow Simulation active at: http://localhost:${config.port}/api/shadow`);
40-
});
37+
const PORT = process.env.PORT || 5000;
38+
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));

src/api/axios.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// src/api/axios.js
21
import axios from 'axios';
32

43
const API = axios.create({
5-
baseURL: 'http://localhost:5000/api',
4+
// VITE_API_URL should be set to https://elevate-ai-2.onrender.com/api in your Render settings
5+
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:5000/api',
66
});
77

88
API.interceptors.request.use((config) => {
9-
const token = localStorage.getItem('token'); // This must match the key used in Login.jsx
9+
const token = localStorage.getItem('token');
1010
if (token) {
11-
config.headers.Authorization = `Bearer ${token}`; // Must include 'Bearer ' prefix
11+
config.headers.Authorization = `Bearer ${token}`;
1212
}
1313
return config;
1414
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy