- This is the websocket backend server for Genshin Ban Pick
- Tech stack:
- gorilla/websocket
- redis
- spf13/viper
- git
- golang 1.19
- Install dependencies:
- Run:
go mod download
- Run:
-
RUN:
go run cmd/ws/main.go
-
Note:
- You may need to run redis database and config them first to run the app
- Check
docker-compose.yaml
andconfig.yaml
- Build:
docker build -t gbp_ws:latest .
- To build and run the entire stack (gbp_ws and redis):
- Run:
docker-compose up -d
- Run:
- Run:
go test ./internal/test/... -cover -coverpkg ./...
cmd
: This contains all the run commands for the appws/main.go
: run the websocket server
pkg
: Contains all the pkg, helper modules to build the appconf
: Contains helper function for app configurationsconn
: Contains helper functions to connect to redisglobal
: Contains singleton global configurationgstatus
: Contains enums, global structshelper
: Contains general helper functions
internal
: Contain endpoint and logic for each API. The structure of this module is as follows:handler
: Handle the all the endpoints of the application (take request, get input and pass it to logic layer)logic
: Logic Layer, all the logic of the service are handled herebroker
: All the websocket messages are translated to input for logic functions