Neutral, Plus or Minus

    moleculer-grpc-api

    1.2.5 • Public • Published

    moleculer-grpc-api

    Moleculer gRPC API mixin for Moleculer API Gateway

    Features

    Install

    npm i moleculer-grpc-api moleculer-web
    

    Usage

    This example demonstrates how to setup a Moleculer API Gateway with gRPC mixin in order to handle incoming gRPC requests.

    "use strict";
     
    const { GrpcService } = require("moleculer-grpc-api");
     
    module.exports = {
        name: "grpc",
     
        mixins: [
     
            // gRPC Server
            GrpcService({
     
                // Directory with you .proto files
                directory: `${dirname}/../protos`,
     
                // gRPC port. Default: 50051
                port: ``
     
                // List of actions available. ${protoPackage}.${protoService}/${serviceName}: ${moleculerService}.${moculerAction}
                aliases: {
                    'helloworld.Greeter': {
                        'sayHello': 'greeter.sayHello'
                    }
                },
     
                // Authentication action to populate ctx.user using header
                authentication: {
                    action: "user.currentUser",
                    params: {
                        accessToken: "Authorization"
                    }
                },
            })
        ]
    };
     

    Start your Moleculer project and send gRPC requests.

    Contribution

    Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.

    License

    The project is available under the MIT license.

    Install

    npm i moleculer-grpc-api

    DownloadsWeekly Downloads

    4

    Version

    1.2.5

    License

    MIT

    Unpacked Size

    7.44 kB

    Total Files

    5

    Last publish

    Collaborators

    • brunonunes