https://github.com/nime88/forestry-game
- Install node.js if you don't have it (npm comes included)
cd frontend
npm install
cd frontend
npm start
- Server starts at localhost:3000
The environment supports hot reloading, so the site automatically refreshes every time a file is changed.
The frontend's package.json has a proxy setting in it:
"proxy": "http://localhost:8080"
This way, the frontend app automatically redirects requests to routes not found from it's own server to localhost:8080. So with the backend running at localhost:8080, requests in the frontend code to eg. /api/v1/give/me/stuff will be forwarded to the backend.
This is not neccessary in development, but the project is set up so that this should already work.
cd frontend
npm run build
- The whole frontend gets compiled into static files to build folder
- Move the contents of build folder to forestry_game/static
- Run Django app
- Go to localhost:8080
Result: The whole app, backend and frontend, running under the single Django server.