CORS Error for Get Request using Mobygames api

Hello Mosh, I am working on React Beginner’s course. We all know that rawg api is not working anymore so I prefer for mobygames api and when I am trying to fetch the games list, I am getting CORS Error as status. How to resolve this issue? When I enter the Url in the browser along with key as querystring.. response is coming and I can see the json response in the browser

Thanks, I have fixed the issue.

Paste the code in vite.config.ts

export default defineConfig({

plugins: [react()],

server: {

proxy: {

“/api/moby”: {

target: “https://api.mobygames.com”,

changeOrigin: true,

rewrite: (path) => path.replace(/^\/api\/moby/, “”),

  },

},

},

});

and api-client should have below code

export default axios.create({

baseURL: “/api/moby/v1”,

params: {

api_key: “$$$$$$”,

limit: 1,

offset: 0,

},

});