I build a MERN stack website and deployed it using vercel and my site url is https://hotel-website-amaan.vercel.app/ . It used to work but now I am faced with the error Failed to load resource: net::ERR_BLOCKED_BY_CLIENT . But my site works fine in development that means on http://localhost:5173/. I have not deployed backend anywhere.
backend app.js code
import express from "express"
import cors from 'cors'
import connectDB from "./database/connect.js";
import { config } from 'dotenv';
import rooms from "./routes/rooms.js";
config()
const app = express();
const port = process.env.PORT
// middleware
app.use(express.json())
app.use(cors({credentials: true, origin: 'http://localhost:5173'}));
//Routes
app.use('/rooms' , rooms);
const start = async () => {
try {
await connectDB(process.env.connectionString);
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
} catch (error) {
console.log('error', error.message);
}
}
start();
frontend code- function which is fetching the resource using axios.
import axios from 'axios';
export const fetchAllRoomsFunc = async () => {
// const response = await api.get('/all');
const response = await axios.get('http://localhost:8000/rooms/all');
return response.data.room;
}
website used to work fine after deployment, I don’t know what I did to cause this problem.
Thanks.