https://github.com/jcpsantiago/protopretzel
🥨0100110🥨 Protocol Buffers for Plumber APIs
https://github.com/jcpsantiago/protopretzel
api plumber protocol-buffers r shared-lib
Last synced: 4 months ago
JSON representation
🥨0100110🥨 Protocol Buffers for Plumber APIs
- Host: GitHub
- URL: https://github.com/jcpsantiago/protopretzel
- Owner: jcpsantiago
- License: other
- Created: 2019-02-22T16:38:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-24T09:10:27.000Z (almost 6 years ago)
- Last Synced: 2024-11-30T16:38:23.125Z (5 months ago)
- Topics: api, plumber, protocol-buffers, r, shared-lib
- Language: R
- Homepage:
- Size: 86.9 KB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - jcpsantiago/protopretzel - 🥨0100110🥨 Protocol Buffers for Plumber APIs (R)
README
[](https://travis-ci.org/ozean12/protopretzel)
[](https://codecov.io/github/ozean12/protopretzel?branch=master)
[](https://www.tidyverse.org/lifecycle/#experimental)
[](https://opensource.org/licenses/MIT)# protopretzel
[Protocol Buffers](https://developers.google.com/protocol-buffers/) filter and
serializer for [Plumber](https://www.rplumber.io/).The **ProtoBuf filter** will unserialize ProtoBuf messages according
to the `messagetype` set in the request header
(e.g. `Content-Type: application/x-protobuf; messagetype=prototest.TestPayload`),
and matching a `.proto` descriptor file.The **ProtoBuf serializer** serializes an [RProtoBuf](https://github.com/eddelbuettel/rprotobuf)
message descriptor object, adding the type of message to the response header.`protopretzel` is under active development and things may break. Check out the [protopretzel-playground](https://github.com/ozean12/protopretzel-playground) for an example implementation.
## Installation
You can install the current development version of protopretzel with:
``` r
# install.packages("devtools")
devtools::install_github("ozean12/protopretzel")
```## Example
``` r
library(plumber)
library(protopretzel)# Needs to be added before API creation
addProtobufSerializer()api <- plumber$new("api.R")
addProtobufFilter(api, descriptor_path = "prototest.proto")
api$run(host = "0.0.0.0", port = 8000)
```