go-mixplus

module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0

README

go-mixplus

A cloud-native Go microservices framework with cli tool for productivity.

Installation

Run the following command under your project:

go get -u github.com/mix-plus/go-mixplus

Upgrade

go install github.com/mix-plus/go-mixplus/tools/mpctl@latest

Quick Start

  1. install mpctl
# for Go 1.15 and earlier
GO111MODULE=on go get -u github.com/mix-plus/go-mixplus/tools/mpctl@latest

# for Go 1.16 and later
go install github.com/mix-plus/go-mixplus/tools/mpctl@latest

# generate 
mpctl new helloservice

the generated files look like

.
├── LICENSE
├── Makefile
├── README.md
├── api
│   ├── buf.lock
│   ├── buf.yaml
│   ├── hello
│   │   └── v1
│   │       ├── hello.pb.go
│   │       ├── hello.pb.gw.go
│   │       ├── hello.pb.validate.go
│   │       ├── hello.proto
│   │       └── hello_grpc.pb.go
│   └── openapi.yaml
├── buf.gen.yaml
├── buf.work.yaml
├── cmd
│   ├── main.go
│   ├── wire.go
│   └── wire_gen.go
├── etc
│   └── config.yaml
├── go.mod
├── go.sum
└── internal
    ├── README.md
    ├── config
    │   └── config.go
    ├── server
    │   ├── grpc.go
    │   ├── http.go
    │   └── server.go
    ├── service
    │   ├── hello.go
    │   └── service.go
    └── svc
        └── serviceContext.go

11 directories, 27 files

the generated code can be run directly:

go mod tidy
make run

by default, it’s listening on port 8080, while it can be changed in the configuration file.

you can check it by curl:

curl -i 'http://localhost:8080/v1/demo/hello?id=1'

the response looks like below:

HTTP/1.1 200 OK
Content-Length: 32
Connection: keep-alive
Content-Type: application/json
Date: Wed, 12 Apr 2023 07:22:12 GMT
Keep-Alive: timeout=4
Proxy-Connection: keep-alive

{"id":"1","message":"Hello 1 !"}%

LICENSE

Apache License Version 2.0, http://www.apache.org/licenses/

Directories

Path Synopsis
core
di
layout module
pkg
conf Module
contains Module
convert Module
di Module
errcode Module
hash Module
lock Module
migrate Module
resp Module
str Module
validator Module
tools
mpctl Module

Jump to

Keyboard shortcuts

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