Better instructions when building the release build

This commit is contained in:
Imbus 2024-02-12 17:41:59 +01:00
parent 899d1e8a26
commit ccd4fc35f8

View file

@ -24,7 +24,7 @@ make run
The server will be running on `localhost:8080`. This server does not hot reload, so you will need to restart the server after making changes.
Note that without the frontend, the server will **NOT BE SERVING ANY HTML AND RESPOND WITH 404**.
The server works by serving the frontend as static files and providing an API for the frontend to communicate with, but when running the server, the frontend is not built. To build the frontend, you need to navigate to the frontend directory and run `npm run build`. This will create a static bundle in the `frontend/dist` directory, which the server can serve. The `frontend/dist` will have to be moved/renamed to `backend/static` for the full application to work. These steps are automated when building the final release container.
The server works by serving the frontend as static files and providing an API for the frontend to communicate with, but when running the server, the frontend is not built. To build it, refer to the [frontend section](#building-for-production).
If you ever wonder what the makefile does, you can always inspect it. It's quite simple and self-explanatory.
@ -39,6 +39,10 @@ The frontend is built using Vite with React. Vite can initially seem like a conv
First, you need to pull in the dependencies by running `npm install` in the frontend directory.
To spin up the development server, run `npm run dev`. This will start the development server on `localhost:3000`. Note that the backend server should be running for the frontend to work.
### Building for Production
To **build** the frontend, resulting in a static bundle, you need to navigate to the frontend directory and run `npm run build`. This will create a static bundle in the `frontend/dist` directory, which the server can serve. The `frontend/dist` will have to be moved/renamed to `backend/static` for the full application to work. These steps are automated when building the final release container.
## Release Builds
The release build for the backend is a simple binary that can be run on any machine. The release build for the frontend is a static bundle that can be served by any web server.