GithubHelp home page GithubHelp logo

allanoricil / frpc-echo-example Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 249 KB

fRPC example from frpc.io which actually works...

Home Page: https://frpc.io/getting-started/quick-start

Go 100.00%
frpc go

frpc-echo-example's Introduction

Simplest fRPC Example

Contains the source code for the example explained in the fRPC Quick Start Guide. This one actually works...

Requirements

  • go >= 1.18
  • protoc >= 3
brew install go
brew install protoc

Go setup (optional if you have already done it)

Create a directory to serve as the workspace for your go projects

mkdir $HOME/go

Setup GOPATH, GOBIN and PATH env variables as follows

export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

Ensure these variables are also present on every new shell session running the following code to change your shell rc file:

echo "export GOPATH=$HOME/go" >> $HOME/.zshrc
echo "export GOBIN=$GOPATH/bin" >> $HOME/.zshrc
echo "export PATH=$PATH:$GOBIN" >> $HOME/.zshrc

1 - Install protoc-gen-go-frpc

Install protoc-gen-go-frpc plugin running the following command:

go install github.com/loopholelabs/frpc-go/protoc-gen-go-frpc@latest

Verify the package was installed correctly running the following command:

which protoc-gen-go-frpc

From the root of this project, run the following comand to generate the server and client code using the specs in echo.proto

protoc --go-frpc_out=. echo.proto

Verify that echo/echo.frpc.go was created in the root of the project. Open it and change github.com/loopholelabs/polyglot-go to github.com/loopholelabs/polyglot in the imports section, and save.

2 - Install project dependencies

go mod download

3 - Run Server

Open a new terminal and start the server running the following command

go run server/main.go

Server

4 - Run the Client

Open a new terminal and start the client running the following command

go run client/main.go

Client

frpc-echo-example's People

Contributors

allanoricil avatar

Stargazers

 avatar

Watchers

 avatar

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.