go

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0

README

Base Server for Go

Features

  • grpc
  • http
  • long-polling
  • socket

How to add config


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
      • ./grpc-server.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
      • ./http-server.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
      • ./socket-server.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

Path Synopsis
Package config provides a struct that can store json type config file
Package config provides a struct that can store json type config file
log
log
log
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL