archaeopteryx

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 7 Imported by: 2

README

archaeopteryx

This project is a prototype for microservice on Golang with all required dependencies

Structure

  • buf.yaml - general configuration file for the buf generator with paths to .proto files
  • buf.gen.yaml - configuration file for the buf generator for generating different stubs (gRPC, swagger, REST)

Install dependencies

make install

Generate protobuf & docs

make generate

Presequinces

archaeopteryx requires folder for log files. To create it run:

sudo mkdir /var/log/archaeopteryx
sudo chown $USER /var/log/archaeopteryx

Run

To run server use

go run .

Test

gRPC gateway
Hello world

To test REST gRPC gateway use command:

curl -X POST -k http://localhost:8090/v1/hello -d '{"name": " hello"}'

As a result you should get response: {"message":" hello world"}

User V1
Add User

To test REST gRPC gateway use command:

curl -X POST -k http://localhost:8090/v1/user -d '{"name":"bobby","password":"ilu"}'

As a result you should get response: {"id":<random id>}

Get User

To test REST gRPC gateway use command:

curl -X GET -k http://localhost:8090/v1/user?id=123

As a result you should get response: {"name":"Bobby", "password":"qwerty"}

User V2
Add User

To test REST gRPC gateway use command:

curl -X POST -k http://localhost:8090/v2/user -d '{"firstName":"bobby","lastName":"twist","password":"ilu"}'

As a result you should get response: {"id":<random id>}

Get User

To test REST gRPC gateway use command:

curl -X GET -k http://localhost:8090/v2/user?id=123

As a result you should get response: {"firstName":"Bobby", "lastName":"Twist", "password":"qwerty"}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
api
proto
hello_world/v1
Package hello_world is a reverse proxy.
Package hello_world is a reverse proxy.
user/v1
Package user is a reverse proxy.
Package user is a reverse proxy.
user/v2
Package user is a reverse proxy.
Package user is a reverse proxy.

Jump to

Keyboard shortcuts

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