Add demo on devcontainer

This commit is contained in:
Mike Conrad
2025-06-13 20:12:08 -04:00
parent 302cc66d55
commit 7c6e8a88a3
3 changed files with 8 additions and 1 deletions

View File

@ -17,3 +17,5 @@ The examples folder contains several Docker examples.
`examples/fullstack` is a basic example containing a backend NodeJS application with a React frontend as well as a Postgres Database. The project is set up so that you can do all development in dev containers. The `node_modules` folder for the backend is isolated from your host system and only exists inside the running container. For this reason, you will need to use a devcontainer in order to be able to get things like Intellisense and typings.

Binary file not shown.

View File

@ -19,6 +19,11 @@ The first time you run `docker compose up` it may take a few minutes as Docker w
![](./homepage.png)
## Developing
When running the `compose` stack, the backend node_modules are isolated from your host system. This is common in dev environment setups. In this case it is advised to use a Dev container. The following video demonstrates starting a dev container by using the VSCode plugin.
<video src="../../assets/open-dev-container.m4v" controls></video>
### Proxying and routes
You will notice that the backend is listening on `http://0.0.0.0:3333/` but the frontend is making requests to `/api/`. This is designed to mimic how you would deploy something like this in production where the backend would be behind a reverse proxy. Traefik has some really nice middleware that allows us to easily tell it to route requests destined for `/api` to `/`. The bit that handles that are these labels: