groa-router
Router middleware for Groa gRPC framework.
Requirement
Node.js v7.6+ is required, the middleware system of Gora is based on async function.
Installation
Install via NPM:
npm install groa-router --save
Usage
Create a router to manage your gRPC service and corresponding methods:
const Groa = ;const Router = ; const app = ;const router = ; // Add proto fileapp; // package: example.foo// service: Example1// method: echorouter; // Add router middlewareapp; app;
example.proto
syntax = "proto3"; package example.foo; service Example1 { rpc Ping(Echo) returns (Echo) {} rpc Echo(Echo) returns (Echo) {} rpc Hello(Hello) returns (Hello) {}} message Echo { string content = 1;} message Hello { string msg = 1;}
Router Prefixes
Route paths can be prefixed at the router level:
// package: example.foo// service: Example1const router = prefix: 'example.foo.Example1'; // method: echorouter;
License
Licensed under the MIT License
Authors
Copyright(c) 2017 Fred Chien(錢逢祥) <cfsghost@gmail.com>