Skip to content

LorisRue/IGDB-Proxy-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IGDB Proxy Server API

Is a workaround if you have issues with CORS when accesing the IGDB API for a Web Project by making a Proxy Server

How to use

Backend Setup

  • Make sure you have Node JS installed on your machine
  • open a terminal in this directory
  • run npm install to install the dependencies
  • run node index.js to start the server

Access from frontend

Example in Javascript

const UserId = YOUR USERid;
const Token = YOUR TOKEN;
const ApiNode = 'games';
const Query = 'fields *; sort rating_count desc;';
try {
    const response = await fetch(
        'http://localhost:8000/fetchIGDBData', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(
                { UserId, Token, ApiNode, Query })
    });
    const data = await response.json();
    return data;
} catch (error) {
    console.error(error);
    return undefined;
}

About

NodeJS Proxy Server for IGDB API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published