Coder Social home page Coder Social logo

oslabs-beta / tropicrpc Goto Github PK

View Code? Open in Web Editor NEW
153.0 6.0 5.0 3.92 MB

A VS Code extension that provides gRPC API endpoint testing.

Home Page: http://tropicRPC.io

License: MIT License

TypeScript 99.68% JavaScript 0.32%
grpc server-streaming grpc-requests client-streaming vscode-extension bidirectional-streaming grpc-node grpc-client rpc-framework

tropicrpc's Introduction

What is tropicRPC? ๐Ÿ

A Visual Studio Code extension that provides gRPC Remote Procedure Call (gRPC) API endpoint testing.

Core Features โšก

  • Starts your gRPC server
  • Generates a configuration file within the open VS Code project to be populated with the user's server and request information
  • On save, tropicRPC will make a remote procedure call (RPC) from an auto-generated client
  • tropicRPC supports the following RPC types:
    • unary
    • client-streaming
    • server-streaming
    • bidirectional streaming
  • The server response is displayed in the VS Code tropicRPC output channel

Getting Started

Installation

tropicRPC can be installed from the VS Code Extensions Marketplace here.

Setting up the config file

Open the command palette in VS Code (Cmd/Ctrl + Shift + P) and select tropicRPC: Create Config File. A default config file will be generated. Follow the instructions in the config object to update the entry, portNumber, ipAddress, protoFile, and protoPackage.

config demo gif

tropicRPC's mock API

A mock gRPC API was built for testing tropicRPC during development. This mock API is open-sourced for users to test the tropicRPC extension. It's available in this GitHub repository.

Write Your First tropicRPC gRPC Request

  1. Search for tropicRPC using the VS Code Command Palette (Cmd/Ctrl + Shift + P) and run the tropicRPC: Activate command.

  2. In the 'request' object, set the values of the 'service', 'method', and 'message' properties appropriately.

  3. On every config file save, tropicRPC will send the request(s) and display your server results in the output channel.

    • For unary and server-streaming RPCs, add fields as properties on request object
    • For client-streaming and bidirectional RPCs, add each stream as an object nested under the request object
// add config details here
const config = {
  // OPTIONAL: change './server/index.js' to the relative path from the root directory to the file that starts your server
  // or '' if you do not need tropicRPC to start your server
  entry: './server/index.js',

  // OPTIONAL: change 3000 to the port number on which your server runs
  portNumber: 3000,

  // OPTIONAL: populate '' with the IP address of your server (exclude portNumber)
  ipAddress: '',

  // change './demo.proto' to the relative path from the root directory to your proto file
  protoFile: 'src/proto/demo.proto',

  // change 'protoPackage' to your proto package's name
  protoPackage: 'protoPackage',
};

// after activating tropicRPC extension, add request(s) here and save this file to execute
const requests = {
  // customize your request values below
  request1: {
    service: 'serviceName',
    method: 'unaryMethod',
    message: {
      field1: 0,
      field2: 'Hello World',
    },
  },
  Request2: {
    service: 'serviceName',
    method: 'clientStreamingMethod',
    message: {
      0: {
        field1: 0,
        field2: 'Hello World',
      },
      1: {
        field1: 1,
        field2: 'Bye World',
      },
    },
  },
  // add additional request objects below, as necessary, using the above format
};

request demo gif

Ending Your tropicRPC Session

When you are ready to end your session, search for tropicRPC using the VS Code Command Palette (Cmd/Ctrl + Shift + P) and run the tropicRPC: Deactivate command. Deactivating the extension will stop your server.

Troubleshooting: Changing Your Server Path

After initially setting your server path, any additional updates to the path will require the extension to be deactivated and then reactivated for changes to take effect.

Future Features ๐Ÿน

  • Support for additional metadata in request
  • Predictive text for services and methods
  • Schema / service method preview via hovering
  • Auto-identification of gRPC requests
  • Historical log of all requests and responses

Built By ๐Ÿ’›

tropicrpc's People

Contributors

edkchow avatar joycelo avatar rosedamasco avatar shahrukhanhub avatar stevencanavan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tropicrpc's Issues

'Create Config File' error

image

Running command Create Config File resulted in error: 'A root folder was not found'. Did I miss any step? Thank you.

Does Package name work?

Hi, this is nice plugin, but I wasn't able to make it work if the package name is Java style, like com.example.demo in the proto file. In sendgRPCRequest.ts, it tries to check if the grpcObject has a property of packageName {grpcObject.hasOwnProperty(protoPackage)}. This seems does not work on dot separated package name. I printed the grpcObject in jason format, it looks like below. So it won't have com.example.demo property, instead it has com, then example, then demo, etc.

{"com":{"example":{"demo":{"Name":{"format":"Protocol Buffer 3 DescriptorProto","type":{"field":[

However I'm not sure if there's an issue or I didn't use it correctly. Let me know your opinion.

Thanks!
James

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.