Skip to content

Instantly share code, notes, and snippets.

@cfsghost
Created September 26, 2017 22:31
Show Gist options
  • Save cfsghost/e4cf43bde07ee3f56d053a3a13ddd549 to your computer and use it in GitHub Desktop.
Save cfsghost/e4cf43bde07ee3f56d053a3a13ddd549 to your computer and use it in GitHub Desktop.
Groa.js : Koa-like gRPC Middleware Framework - example1.js
const Groa = require('groa');
const app = new Groa();
// Add proto file
app.addProto(__dirname + '/example1.proto');
// Add middleware
app.use(async (ctx, next) => {
// response
ctx.body = ctx.req.body;
});
app.listen(50051, () => {
console.log('Listening on port 50051');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment