This repository is part of the project briefly. Briefly project is a URL shortcoder.
This repository concern the gRPC server to generate ID of a received URL and a answer an URL link to an ID (previously associated to an ID)
Prototool is neccessary to generate protobuf
Info: Into the pipeline to migrate to buf
$ GO111MODULE=on go get github.com/uber/prototool/cmd/prototool@dev
Please install mage
$ mage
An artifact named 'briefly' is generated in './bin/' folder
$ ./bin/briefly config new
will generate a default configuration file
###############################
# Briefly Settings
###############################
[Briefly]
###############################
# GRPC API settings
###############################
[Briefly.GRPC]
# On which port REST HTTP service will listen
listenPort = 5556
###############################
# Logs Settings
###############################
[Log]
# Allow to display logs in Json format if true
jsonformatter = false
# Log level: trace, debug, info, warning, error, panic, and fatal
level = "warning"
store it as toml file, in example in 'conf' folder onto './conf/briefly.conf.toml' file
$ ./bin/briefly startGrpc --config ./conf/briefly.conf.toml
$ prototool grpc --address localhost:5556 --method briefly.schema.v1.SchemaAPI/GetShortCodeHash --data '{"url":"test"}'
{"hash":"13606376228"}
$ prototool grpc --address localhost:5556 --method briefly.schema.v1.SchemaAPI/GetUnShortCodedURL --data '{"hash":"test"}'
{"url":"https://www.google.com"}