ptzagk / go-embed-spa

Go Embed Single-Page Application

Home Page:https://youtu.be/HSZ-1tOt7uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Embed Single-Page Application

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.

Tech

Build the image

Go HTTP standard library

make build

Echo framework

make build APP_NAME=echo

Fiber framework

make build APP_NAME=fiber

Run the application

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

About

Go Embed Single-Page Application

https://youtu.be/HSZ-1tOt7uk


Languages

Language:Go 47.2%Language:Svelte 19.5%Language:Dockerfile 14.2%Language:Makefile 7.9%Language:HTML 4.7%Language:JavaScript 3.4%Language:CSS 3.1%