This project is an upload and download microservice of Amazon S3.
Use go get to retrieve the project to add it to your GOPATH workspace, or project's Go module dependencies.
go get github.com/lxlxw/s3-microTo update the project use go get -u to retrieve the latest version of the project.
go get -u github.com/lxlxw/s3-microcat ./conf/s3.toml[S3]
accesskey = "AKIAJCWZ4372EFTEW6ZA"
secretkey = "xxxxxx"
region = "us-east-1"
endpoint = "s3.amazonaws.com"$ cd "$GOPATH/src/github.com/lxlxw/s3-micro"
make buildmake servermake httpcurl -X POST -k http://localhost:8088/api/object/upload -d '{"bucketname": "test_bucket", "key":"test/test.txt", "filecontent":"xxxxxx"}'You find more detailed api documentation at /doc.
or
open http://localhost:8088/swagger-ui
create a service client, make a request, handle the error, and process the response.
package main
import (
"log"
"golang.org/x/net/context"
"google.golang.org/grpc"
pb "github.com/lxlxw/s3-micro/proto"
)
func main() {
conn, err := grpc.Dial(":50052", grpc.WithInsecure())
if err != nil {
log.Println(err)
}
defer conn.Close()
// new client
c := pb.NewStoreApiServiceClient(conn)
// call method
req := &pb.CreateBucketRequest{Bucketname: "test-bucket"}
res, err := c.CreateBucket(context.Background(), req)
if err != nil {
log.Println(err)
}
log.Println(res.Msg)
}- gRPC
- RESTful API
- Swagger UI
- Middleware
- App configurable
- Logging
- JWT Authorization
If you find a bug, please submit the issue in Github directly. S3-Micro Issues
- Email:[email protected]
S3-Micro is based on the MIT protocol.