//utils/api.js
import axios from 'axios';
const path = "http://(express api ip):8000"
export const newIdGenerate = () => {
return axios.get(path+"/api/generateid")
.then(result => {
return result.data.nextid;
})
.catch(error => {
console.error(error);
throw error;
})
}
In localhost, It work but in vercel, it didn't;
How can i solve it?
express server is hosting in AWS. It work.
I try CORS setting
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
async rewrites() {
return [
{
source: "/api/:path*",
destination: "http://(ip):8000/api/:path*",
},
];
},
}