百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

grpc-web-hacker-news

> 前端框架
开源

一个在 React 中使用 gRPC-Web 和 Go 后端实现 Hacker News 阅读器的示例应用

389 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个在 React 中使用 gRPC-Web 和 Go 后端实现 Hacker News 阅读器的示例应用

grpc-web-hacker-news

An example app implementing a Hacker News reader. This example aims to demonstrate usage of grpc-web(v0.5.0) with React. It additionally shows how to integrate with Redux.

Running

To start both the Go backend server and the frontend React application, run the following:

bash
./start.sh

The backend server is running on http://localhost:8900 while the frontend will by default start on http://localhost:3000

Contributing

Contributions are welcome, please open an Issue or raise a PR.

Notable setup points

Disable TSLint for protobuf generated classes

Gernerated proto classes do not confirm to TS lint requirements, disable linting

json
{
    "linterOptions": {
        "exclude": [
            "src/proto/*"
        ]
    },
}

Configure protobuf compiler script

In this example, we're using a protoc.sh script to aid compilation

bash
protoc \
    --go_out=plugins=grpc:./server \
    --plugin=protoc-gen-ts=./app/node_modules/.bin/protoc-gen-ts \
    --ts_out=service=true:./app/src \
    --js_out=import_style=commonjs,binary:./app/src \
    ./proto/hackernews.proto

Generated proto classes with Redux

Redux favors plain objects over object instances. This complicates usage of the generated proto classes, in this example class Story. In order to use the generated classes with redux, we must use the Story.AsObject type which is the plain object representation. For example our reducer should look like this:

…

Note the usage of Story.AsObject rather than just Story

gRPC-Web Redux Middleware

An example redux middleware is included.

…

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptexamplegolanggrpcgrpc-web

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架