Skip to content

femito1/WASA

Repository files navigation

Project structure

  • cmd/ contains all executables; Go programs here should only do "executable-stuff", like reading options from the CLI/env, etc.
    • cmd/healthcheck is 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/webapi contains an example of a web API server daemon
  • demo/ contains a demo config file
  • doc/ contains the documentation (usually, for APIs, this means an OpenAPI file)
  • service/ has all packages for implementing project-specific functionalities
    • service/api contains an example of an API server
    • service/globaltime contains a wrapper package for time.Time (useful in unit testing)
  • vendor/ is managed by Go, and contains a copy of all dependencies
  • webui/ 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.sh starts a new (temporary) container using node:20 image for safe and secure web frontend development (you don't want to use node in your system, do you?).

Go vendoring

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:

Node/YARN 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.

How to set up a new project from this template

You need to:

  • Change the Go module path to your module path in go.mod, go.sum, and in *.go files around the project
  • Rewrite the API documentation doc/api.yaml
  • If no web frontend is expected, remove webui and cmd/webapi/register-webui.go
  • Update top/package comment inside cmd/webapi/main.go to 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 inside service/ (or subdirectories)

How to run with docker compose (recommended)

# clone project into directory of choice (e.g. wasa)
git clone https://github.com/femito1/WASA.git wasa

# cd to the project's parent directory (wasa in this case)
cd wasa

# make sure docker engine is running (e.g. Docker Desktop)
docker compose up -d

#once finished, access the project's frontend at https://localhost:80

License

See LICENSE.

About

Repo for my Web and Software Architecture class

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors