An open API service indexing awesome lists of open source software.

https://github.com/lordvidex/go-example-server


https://github.com/lordvidex/go-example-server

docker-compose golang grpc-go rest-api

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# go-example-server Go Reference
Learning golang for servers and microservices

## How To Run?

> ### Server

The server processes can be started `locally` with the make command below.

**REST and gRPC servers**
```bash
make server # starts the REST & gRPC server
```
OR
**Docker**
```bash
docker-compose up
```

> ### Client
#### HTTP
**HTTP client**
```bash
curl http://localhost:3000/product # all items
curl https://localhost:3000/product/1 # single item
```
#### GRPC
**gRPC client**
```bash
bash ./client.sh # returns a single item through gRPC
bash ./client.sh -all # returns a stream of items through gRPC
```
OR.
**with [grpcurl](https://pkg.go.dev/github.com/fullstorydev/grpcurl#section-readme)**
```bash
grpcurl -d '{"id": "2"}' --plaintext localhost:3000 Product.GetProduct # get single

grpcurl --plaintext localhost:3000 Product.GetProducts # get all
```

### **DockerHub** *pull project directly from docker*
Project can be pulled from docker hub and run directly from docker

```bash
docker pull lordvidex/goserver:latest
```