This commit is contained in:
Imbus 2024-02-12 16:54:43 +01:00
parent 7dc76a2679
commit 9bee1dda88

View file

@ -21,6 +21,8 @@ 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. 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.
> 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.
If you ever wonder what the makefile does, you can always inspect it. It's quite simple and self-explanatory. If you ever wonder what the makefile does, you can always inspect it. It's quite simple and self-explanatory.
## Frontend ## Frontend
@ -29,7 +31,7 @@ The frontend code might look very intimidating at first, but it's actually quite
The important parts resides in the `src` directory, which contains the actual React components and corresponding styles. The important parts resides in the `src` directory, which contains the actual React components and corresponding styles.
The frontend is built using Vite with React. Vite handles hot reloading and bundling. The frontend is built using Vite with React. Vite can initially seem like a convoluted mess of a build tool, but it's job essentially boils down to two things: bundling and hot reloading. The final output is static html, css, and javascript files that can be served by any web server.
First, you need to pull in the dependencies by running `npm install` in the frontend directory. 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. 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.