module
Version:
v1.1.0
Opens a new window with list of versions in this module.
Published: Apr 19, 2024
License: Apache-2.0
Opens a new window with license information.
README
¶
Base Server for Go
Features
- grpc
- http
- long-polling
- socket
How to add config
- json type config file add
- struct add
- test add
- example of use
How to use server
- cloudevents
- build
go build -o ./bin/cloudevents-server ./cloudevents-server/
- run
./bin/cloudevents-server -config-file ./config/CloudEventsServer.config
- grpc
- build
go build -o ./bin/grpc-server ./grpc-server/
- run
./bin/grpc-server -config_file ./config/GrpcServer.config
- log
- http
- build
go install github.com/swaggo/swag/cmd/swag@v1.16.3
$(go env GOPATH)/bin/swag init --dir ./http-server --output ./http-server/swagger_docs
go build -o ./bin/http-server ./http-server/
- run
./bin/http-server -config_file ./config/HttpServer.config
- log
- long-polling
- build
go build -o ./bin/long-polling-server ./long-polling-server/
- run
./bin/long-polling-server -config_file ./config/LongPollingServer.config
- log
./long-polling-server.log
- socket
- build
go build -o ./bin/socket-server ./socket-server/
- run
./bin/socket-server -config_file ./config/SocketServer.config
- log
Test and Coverage
- Test
go clean -testcache && go test -cover ./...
- Coverage
- make coverage file
go clean -testcache && go test -coverprofile=coverage.out -cover $(go list ./... | grep -v "/swagger_docs")
- convert coverage file to html file
go tool cover -html=./coverage.out -o ./coverage.html
Directories
¶
|
|
Package config provides a struct that can store json type config file
|
Package config provides a struct that can store json type config file |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.