Although there are many alternatives to deploying a single-page application, you might find a situation where you need to deploy it in an isolated environment or just portability concern.
The example is using SvelteKit to generate a single-page application and embed it with Golang with Docker multi-stage build for smaller image.
Go HTTP standard library
make build
Echo framework
make build APP_NAME=echo
Fiber framework
make build APP_NAME=fiber
The default port is 5050
, configure a runnable app port with APP_PORT=xxxx
.
Go HTTP standard library
make run
Echo framework
make run APP_NAME=echo APP_PORT=5051
Fiber framework
make run APP_NAME=fiber APP_PORT=5052