This project sets up a local proxy server to make production data available locally without encountering CORS and similar issues. It uses an Express server to fetch data from the production API and serves it locally. Additionally, browser-sync
is used to proxy the local server, making it accessible from a specific domain.
- Run the combined script to start both the Express server and
browser-sync
:npm start
- Access the available endpoints served locally from:
This page will display a list of all available endpoints, including the "lobby" endpoint and any future endpoints.
https://web.develop.danskespil.dk:1337
To use the endpoint in your code, you can create a function like this:
export const getLobbyData = async () => {
return await ApiRequest({ url: 'https://web.develop.danskespil.dk:1337/dli/scapi/danskespil/gamevendorgvc/lobby' });
};
If the port is wrong, try killing all stuck or running localhosts:
npm run reset