Questo progetto è pubblico e condiviso con l'intento di essere utile a chiunque voglia modificarlo e riutilizzarlo per il proprio lavoro o per fini didattici. Sei libero di copiarlo, distribuirlo e adattarlo come preferisci (tanto io l'esame l'ho fatto).
Questi sono i voti parziali del mio progetto:
last update 10/07/2025
cmd/contains all executables; Go programs here should only do "executable-stuff", like reading options from the CLI/env, etc.cmd/healthcheckis an example of a daemon for checking the health of servers daemons; useful when the hypervisor is not providing HTTP readiness/liveness probes (e.g., Docker engine)cmd/webapicontains an example of a web API server daemon
demo/contains a demo config filedoc/contains the documentation (usually, for APIs, this means an OpenAPI file)service/has all packages for implementing project-specific functionalitiesservice/apicontains an example of an API serverservice/globaltimecontains a wrapper package fortime.Time(useful in unit testing)
vendor/is managed by Go, and contains a copy of all dependencieswebui/is an example of a web frontend in Vue.js; it includes:- Bootstrap JavaScript framework
- a customized version of "Bootstrap dashboard" template
- feather icons as SVG
- Go code for release embedding
Other project files include:
open-node.shstarts a new (temporary) container usingnode:20image for safe and secure web frontend development (you don't want to usenodein your system, do you?).
This project uses Go Vendoring. You must use go mod vendor after changing some dependency (go get or go mod tidy) and add all files under vendor/ directory in your commit.
For more information about vendoring:
This repository uses yarn and a vendoring technique that exploits the "Offline mirror". As for the Go vendoring, the dependencies are inside the repository.
You should commit the files inside the .yarn directory.
You need to:
- Change the Go module path to your module path in
go.mod,go.sum, and in*.gofiles around the project - Rewrite the API documentation
doc/api.yaml - If no web frontend is expected, remove
webuiandcmd/webapi/register-webui.go - Update top/package comment inside
cmd/webapi/main.goto reflect the actual project usage, goal, and general info - Update the code in
run()function (cmd/webapi/main.go) to connect to databases or external resources - Write API code inside
service/api, and create any further package insideservice/(or subdirectories)
If you're not using the WebUI, or if you don't want to embed the WebUI into the final executable, then:
go build ./cmd/webapi/If you're using the WebUI and you want to embed it into the final executable:
./open-node.sh
# (here you're inside the container)
yarn run build-embed
exit
# (outside the container)
go build -tags webui ./cmd/webapi/You can launch the backend only using:
go run ./cmd/webapi/If you want to launch the WebUI, open a new tab and launch:
./open-node.sh
# (here you're inside the container)
yarn run dev./open-node.sh
# (here you're inside the container)
yarn run build-prodFor "Web and Software Architecture" students: before committing and pushing your work for grading, please read the section below named "My build works when I use yarn run dev, however there is a Javascript crash in production/grading"
Some errors in the code are somehow not shown in vite development mode. To preview the code that will be used in production/grading settings, use the following commands:
./open-node.sh
# (here you're inside the container)
yarn run build-prod
yarn run previewSee LICENSE.