Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericbets/danby
A webserver that's also a grpc proxy for browsers
https://github.com/ericbets/danby
grpc grpc-framework grpc-gateway grpc-java grpc-web microservice nodejs proxy
Last synced: 3 months ago
JSON representation
A webserver that's also a grpc proxy for browsers
- Host: GitHub
- URL: https://github.com/ericbets/danby
- Owner: ericbets
- Created: 2018-02-16T06:02:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T16:14:41.000Z (almost 2 years ago)
- Last Synced: 2024-04-18T16:57:53.554Z (7 months ago)
- Topics: grpc, grpc-framework, grpc-gateway, grpc-java, grpc-web, microservice, nodejs, proxy
- Language: JavaScript
- Homepage:
- Size: 242 KB
- Stars: 30
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-grpc - danby - A grpc proxy for the browser (Tools / Other)
- awesome-list-microservice - danby
README
Danby
===================Lightweight approach to grpc microservices in the browser. No client side lib required.
Features
--------
* Bare minimum configuration required, uses helmet.js to set HTTP headers to sane defaults.
* Proxy multiple grpc microservices to this webserver, as long as they have unique grpc service names.
* Proxy multiple routes to other http servers. Eg. "/" to localhost:3000 might map to a react app.Usage
--------
To install using globally, try --unsafe-perm or --allow-root [why](https://github.com/nodejs/node-gyp/issues/454)```shell
$ npm install danby$ danby
Options:
--help Show help [boolean]
--version Show version number [boolean]
--port http port [required]
--cfg path to toml config file
--cert path to ssl/tls cert file
--key path to ssl/tls private key
--webroot path to webroot, defaults to $PWD
--debug debug output to console
```Example
-------
Let's say you want to serve some static files with access to the grpc Greeter interface.
Add this into the head tag of your chosen html file:```html
```
Now modify config.toml.sample to suit your local environment. Then from the console, cd into the folder you want to serve:
```shell
$ cd website
$ danby --port 3000 --cfg config.toml
```Now in the browser:
```js
//Manage call creds by setting the metadata eg. Greeter.metadata["token"] = ...
Greeter.SayHello({name: 'user'}).then(function(resp) { console.log(resp); });
```In your config file, try to use absolute paths for your .proto files otherwise the paths will be relative to the folder you started the webserver in, not the config file. Or start the webserver from your config folder, and use --webroot.
Todo
------
* Streaming support
* Let user choose between Promises or Callbacks