Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update references #742

Merged
merged 6 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ $(GEN)/connect: node_modules/.bin/protoc-gen-es packages/connect/buf.gen.yaml $(
$(GEN)/connect-web-test: node_modules/.bin/protoc-gen-es $(BUILD)/protoc-gen-connect-es packages/connect-web-test/buf.gen.yaml Makefile
rm -rf packages/connect-web-test/src/gen/*
npm run -w packages/connect-web-test generate https://github.com/bufbuild/connect-crosstest.git#ref=$(CROSSTEST_VERSION),subdir=proto
npm run -w packages/connect-web-test generate buf.build/bufbuild/eliza
npm run -w packages/connect-web-test generate buf.build/connectrpc/eliza
@mkdir -p $(@D)
@touch $(@)

Expand All @@ -137,7 +137,7 @@ $(GEN)/connect-node-test: node_modules/.bin/protoc-gen-es $(BUILD)/protoc-gen-co

$(GEN)/connect-web-bench: node_modules/.bin/protoc-gen-es $(BUILD)/protoc-gen-connect-es packages/connect-web-bench/buf.gen.yaml Makefile
rm -rf packages/connect-web-bench/src/gen/*
npm run -w packages/connect-web-bench generate buf.build/bufbuild/eliza:847d7675503fd7aef7137c62376fdbabcf777568
npm run -w packages/connect-web-bench generate buf.build/connectrpc/eliza:d8fbf2620c604277a0ece1ff3a26f2ff
@mkdir -p $(@D)
@touch $(@)

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ can `curl` them if you want:
curl \
--header 'Content-Type: application/json' \
--data '{"sentence": "I feel happy."}' \
https://demo.connect.build/buf.connect.demo.eliza.v1.ElizaService/Say
https://demo.connectrpc.com/connectrpc.eliza.v1.ElizaService/Say
```

Connect uses [Protobuf-ES](https://github.com/bufbuild/protobuf-es), the only
[fully-compliant](https://buf.build/blog/protobuf-conformance) Protobuf JavaScript library.

Connect implements RPC three protocols: The widely available gRPC and
gRPC-web protocols, and Connect's [own protocol](https://connect.build/docs/protocol/),
gRPC-web protocols, and Connect's [own protocol](https://connectrpc.com/docs/protocol/),
optimized for the web. This gives you unparalleled interoperability across many
platforms and languages, with type-safety end-to-end.


## Get started on the web

Follow our [10 minute tutorial](https://connect.build/docs/web/getting-started) where
Follow our [10 minute tutorial](https://connectrpc.com/docs/web/getting-started) where
we use [Vite](https://vitejs.dev/) and [React](https://reactjs.org/) to create a
web interface for ELIZA.

Expand All @@ -59,11 +59,11 @@ and the [Encoding API](https://developer.mozilla.org/en-US/docs/Web/API/Encoding

## Get started on Node.js

Follow our [10 minute tutorial](https://connect.build/docs/node/getting-started)
Follow our [10 minute tutorial](https://connectrpc.com/docs/node/getting-started)
to spin up a service in Node.js, and call it from the web, and from a gRPC client
in your terminal.

You can serve your Connect RPCs with vanilla Node.js, or use our [server plugins](https://connect.build/docs/node/server-plugins)
You can serve your Connect RPCs with vanilla Node.js, or use our [server plugins](https://connectrpc.com/docs/node/server-plugins)
for **Fastify**, **Next.js**, and **Express**. We support Node.js v16 and later with
the builtin `http` and `http2` modules.

Expand Down Expand Up @@ -108,7 +108,7 @@ The libraries and the generated code are compatible with ES2017 and TypeScript 4
* [connect-go](https://github.com/bufbuild/connect-go):
Go implementation of gRPC, gRPC-Web, and Connect
* [connect-demo](https://github.com/bufbuild/connect-demo):
demonstration service powering demo.connect.build
demonstration service powering demo.connectrpc.com
* [connect-crosstest](https://github.com/bufbuild/connect-crosstest):
gRPC-Web and Connect interoperability tests
* [Buf Studio](https://buf.build/studio): web UI for ad-hoc RPCs
Expand Down
16 changes: 8 additions & 8 deletions packages/connect-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Connect is a family of libraries for building and consuming APIs on different la
[@bufbuild/connect](https://www.npmjs.com/package/@bufbuild/connect) brings type-safe APIs with Protobuf to
TypeScript.

`@bufbuild/connect-express` provides a middleware for [Express](https://expressjs.com/), the fast,
`@bufbuild/connect-express` provides a middleware for [Express](https://expressjs.com/), the fast,
unopinionated, minimalist web framework for Node.js

### expressConnectMiddleware()
Expand Down Expand Up @@ -32,8 +32,8 @@ import express from "express";

const app = express();

+ app.use(expressConnectMiddleware({
+ routes
+ app.use(expressConnectMiddleware({
+ routes
+ }));

http.createServer(app).listen(8080);
Expand All @@ -47,7 +47,7 @@ With that server running, you can make requests with any gRPC-web or Connect cli
curl \
--header "Content-Type: application/json" \
--data '{"sentence": "I feel happy."}' \
http://localhost:8080/buf.connect.demo.eliza.v1.ElizaService/Say
http://localhost:8080/connectrpc.eliza.v1.ElizaService/Say
```

Node.js with the gRPC-web protocol (using a transport from [@bufbuild/connect-node](https://www.npmjs.com/package/@bufbuild/connect-node)):
Expand All @@ -68,14 +68,14 @@ console.log(sentence) // you said: I feel happy.
```

A client for the web browser actually looks identical to this example - it would
simply use `createConnectTransport` from [@bufbuild/connect-web](https://www.npmjs.com/package/@bufbuild/connect-web)
simply use `createConnectTransport` from [@bufbuild/connect-web](https://www.npmjs.com/package/@bufbuild/connect-web)
instead.

Note that support for gRPC is limited, since many gRPC clients require HTTP/2,
Note that support for gRPC is limited, since many gRPC clients require HTTP/2,
and Express does not support the Node.js `http2` module.


## Getting started

To get started with Connect, head over to the [docs](https://connect.build/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
To get started with Connect, head over to the [docs](https://connectrpc.com/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
18 changes: 9 additions & 9 deletions packages/connect-fastify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Connect is a family of libraries for building and consuming APIs on different la
[@bufbuild/connect](https://www.npmjs.com/package/@bufbuild/connect) brings type-safe APIs with Protobuf to
TypeScript.

`@bufbuild/connect-fastify` provides a plugin for [fastify](https://www.fastify.io/), the fast and
`@bufbuild/connect-fastify` provides a plugin for [fastify](https://www.fastify.io/), the fast and
low overhead web framework, for Node.js.

### fastifyConnectPlugin()
Expand Down Expand Up @@ -33,8 +33,8 @@ const server = fastify({
http2: true,
});

+ await server.register(fastifyConnectPlugin, {
+ routes
+ await server.register(fastifyConnectPlugin, {
+ routes
+ });

await server.listen({
Expand All @@ -48,10 +48,10 @@ With that server running, you can make requests with any gRPC, gRPC-Web, or Conn
`buf curl` with the gRPC protocol:

```bash
buf curl --schema buf.build/bufbuild/eliza \
buf curl --schema buf.build/connectrpc/eliza \
--protocol grpc --http2-prior-knowledge \
-d '{"sentence": "I feel happy."}' \
http://localhost:8080/buf.connect.demo.eliza.v1.ElizaService/Say
http://localhost:8080/connectrpc.eliza.v1.ElizaService/Say
```

`curl` with the Connect protocol:
Expand All @@ -61,7 +61,7 @@ curl \
--header "Content-Type: application/json" \
--data '{"sentence": "I feel happy."}' \
--http2-prior-knowledge \
http://localhost:8080/buf.connect.demo.eliza.v1.ElizaService/Say
http://localhost:8080/connectrpc.eliza.v1.ElizaService/Say
```

Node.js with the gRPC protocol (using a transport from [@bufbuild/connect-node](https://www.npmjs.com/package/@bufbuild/connect-node)):
Expand All @@ -82,11 +82,11 @@ console.log(sentence) // you said: I feel happy.
```

A client for the web browser actually looks identical to this example - it would
simply use `createConnectTransport` from [@bufbuild/connect-web](https://www.npmjs.com/package/@bufbuild/connect-web)
simply use `createConnectTransport` from [@bufbuild/connect-web](https://www.npmjs.com/package/@bufbuild/connect-web)
instead.


## Getting started

To get started with Connect, head over to the [docs](https://connect.build/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
To get started with Connect, head over to the [docs](https://connectrpc.com/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
14 changes: 7 additions & 7 deletions packages/connect-next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Connect is a family of libraries for building and consuming APIs on different la
[@bufbuild/connect](https://www.npmjs.com/package/@bufbuild/connect) brings type-safe APIs with Protobuf to
TypeScript.

`@bufbuild/connect-next` provides a plugin for [Next.js](https://nextjs.org/),
`@bufbuild/connect-next` provides a plugin for [Next.js](https://nextjs.org/),
the React Framework for the Web.


### nextJsApiRouter()

Provide your Connect RPCs via Next.js API routes. To enable Connect in Next.js,
Provide your Connect RPCs via Next.js API routes. To enable Connect in Next.js,
add two files to your project:

```diff
Expand All @@ -35,7 +35,7 @@ export default function(router: ConnectRouter) {
}
```

`pages/api/[[..connect]].ts` is a Next.js [catch-all API route](https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes):
`pages/api/[[..connect]].ts` is a Next.js [catch-all API route](https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes):

```ts
// pages/api/[[..connect]].ts
Expand All @@ -56,7 +56,7 @@ curl \
--header "Content-Type: application/json" \
--data '{"sentence": "I feel happy."}' \
--http2-prior-knowledge \
http://localhost:3000/api/buf.connect.demo.eliza.v1.ElizaService/Say
http://localhost:3000/api/connectrpc.eliza.v1.ElizaService/Say
```

Node.js with the gRPC-web protocol (using a transport from [@bufbuild/connect-node](https://www.npmjs.com/package/@bufbuild/connect-node)):
Expand Down Expand Up @@ -88,10 +88,10 @@ and Express does not support the Node.js `http2` module.

Currently, `@bufbuild/connect-next` does not support the Vercel Edge runtime.
It requires the Node.js server runtime, which is used by default when deploying
to Vercel.
to Vercel.


## Getting started

To get started with Connect, head over to the [docs](https://connect.build/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
To get started with Connect, head over to the [docs](https://connectrpc.com/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
11 changes: 5 additions & 6 deletions packages/connect-node-test/src/express-readme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ describe("express readme", function () {
interface SayR extends Message<SayR> {
sentence: string;
}
const SayR = proto3.makeMessageType<SayR>(
"buf.connect.demo.eliza.v1.SayRequest",
[{ no: 1, name: "sentence", kind: "scalar", T: 9 /* ScalarType.STRING */ }],
);
const SayR = proto3.makeMessageType<SayR>("connectrpc.eliza.v1.SayRequest", [
{ no: 1, name: "sentence", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

interface IntroduceRequest extends Message<IntroduceRequest> {
name: string;
}
const IntroduceRequest = proto3.makeMessageType<IntroduceRequest>(
"buf.connect.demo.eliza.v1.IntroduceRequest",
"connectrpc.eliza.v1.IntroduceRequest",
[{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }],
);

const ElizaService = {
typeName: "buf.connect.demo.eliza.v1.ElizaService",
typeName: "connectrpc.eliza.v1.ElizaService",
methods: {
say: {
name: "Say",
Expand Down
17 changes: 8 additions & 9 deletions packages/connect-node-test/src/node-readme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@ describe("node readme", function () {
interface SayR extends Message<SayR> {
sentence: string;
}
const SayR = proto3.makeMessageType<SayR>(
"buf.connect.demo.eliza.v1.SayRequest",
[{ no: 1, name: "sentence", kind: "scalar", T: 9 /* ScalarType.STRING */ }],
);
const SayR = proto3.makeMessageType<SayR>("connectrpc.eliza.v1.SayRequest", [
{ no: 1, name: "sentence", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

interface IntroduceRequest extends Message<IntroduceRequest> {
name: string;
}
const IntroduceRequest = proto3.makeMessageType<IntroduceRequest>(
"buf.connect.demo.eliza.v1.IntroduceRequest",
"connectrpc.eliza.v1.IntroduceRequest",
[{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }],
);

const ElizaService = {
typeName: "buf.connect.demo.eliza.v1.ElizaService",
typeName: "connectrpc.eliza.v1.ElizaService",
methods: {
say: {
name: "Say",
Expand All @@ -61,18 +60,18 @@ describe("node readme", function () {
} as const;

const optionsHttp2 = {
baseUrl: "https://demo.connect.build",
baseUrl: "https://demo.connectrpc.com",
httpVersion: "2" as const,
};
const optionsHttp1 = {
baseUrl: "https://demo.connect.build",
baseUrl: "https://demo.connectrpc.com",
httpVersion: "1.1" as const,
};

it("createConnectTransport()", async function () {
// A transport for clients using the gRPC protocol with Node.js `http` module
const transport = createConnectTransport({
baseUrl: "https://demo.connect.build",
baseUrl: "https://demo.connectrpc.com",
httpVersion: "1.1",
});
const client = createPromiseClient(ElizaService, transport);
Expand Down
6 changes: 3 additions & 3 deletions packages/connect-node-test/src/transports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe("createConnectTransport()", function () {

describe("using a session manager to open a connection before starting an application", function () {
it("should work", async function () {
const sm = new Http2SessionManager("https://demo.connect.build");
const sm = new Http2SessionManager("https://demo.connectrpc.com");
for (let backoff = 1; ; backoff++) {
const state = await sm.connect();
if (state == "error") {
Expand All @@ -93,11 +93,11 @@ describe("using a session manager to explicitly close all connections", function
it("should work", function () {
// create a client, keeping a reference to the session manage
const sessionManager = new Http2SessionManager(
"https://demo.connect.build",
"https://demo.connectrpc.com",
);
createConnectTransport({
httpVersion: "2",
baseUrl: "https://demo.connect.build",
baseUrl: "https://demo.connectrpc.com",
sessionManager,
});
// const client = createPromiseClient(..., transport);
Expand Down
22 changes: 11 additions & 11 deletions packages/connect-node/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @bufbuild/connect-node

Connect is a family of libraries for building and consuming APIs on different languages and platforms, and
[@bufbuild/connect](https://www.npmjs.com/package/@bufbuild/connect) brings type-safe APIs with Protobuf to
Connect is a family of libraries for building and consuming APIs on different languages and platforms, and
[@bufbuild/connect](https://www.npmjs.com/package/@bufbuild/connect) brings type-safe APIs with Protobuf to
TypeScript.

`@bufbuild/connect-node` provides the following adapters for Node.js:
Expand All @@ -17,7 +17,7 @@ import { ElizaService } from "./gen/eliza_connect.js";

+ // A transport for clients using the Connect protocol with Node.js `http` module
+ const transport = createConnectTransport({
+ baseUrl: "https://demo.connect.build",
+ baseUrl: "https://demo.connectrpc.com",
+ httpVersion: "1.1"
+ });

Expand All @@ -37,7 +37,7 @@ import { ElizaService } from "./gen/eliza_connect.js";

+ // A transport for clients using the gRPC protocol with Node.js `http2` module
+ const transport = createGrpcTransport({
+ baseUrl: "https://demo.connect.build",
+ baseUrl: "https://demo.connectrpc.com",
+ httpVersion: "2"
+ });

Expand All @@ -57,7 +57,7 @@ import { ElizaService } from "./gen/eliza_connect.js";

+ // A transport for clients using the Connect protocol with Node.js `http` module
+ const transport = createGrpcWebTransport({
+ baseUrl: "https://demo.connect.build",
+ baseUrl: "https://demo.connectrpc.com",
+ httpVersion: "1.1"
+ });

Expand Down Expand Up @@ -100,10 +100,10 @@ With that server running, you can make requests with any gRPC, gRPC-Web, or Conn
`buf curl` with the gRPC protocol:

```bash
buf curl --schema buf.build/bufbuild/eliza \
buf curl --schema buf.build/connectrpc/eliza \
--protocol grpc --http2-prior-knowledge \
-d '{"sentence": "I feel happy."}' \
http://localhost:8080/buf.connect.demo.eliza.v1.ElizaService/Say
http://localhost:8080/connectrpc.eliza.v1.ElizaService/Say
```

`curl` with the Connect protocol:
Expand All @@ -113,7 +113,7 @@ curl \
--header "Content-Type: application/json" \
--data '{"sentence": "I feel happy."}' \
--http2-prior-knowledge \
http://localhost:8080/buf.connect.demo.eliza.v1.ElizaService/Say
http://localhost:8080/connectrpc.eliza.v1.ElizaService/Say
```

Node.js with the gRPC protocol:
Expand All @@ -134,11 +134,11 @@ console.log(sentence) // you said: I feel happy.
```

A client for the web browser actually looks identical to this example - it would
simply use `createConnectTransport` from [@bufbuild/connect-web](https://www.npmjs.com/package/@bufbuild/connect-web)
simply use `createConnectTransport` from [@bufbuild/connect-web](https://www.npmjs.com/package/@bufbuild/connect-web)
instead.


## Getting started

To get started with Connect, head over to the [docs](https://connect.build/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
To get started with Connect, head over to the [docs](https://connectrpc.com/docs/node/getting-started)
for a tutorial, or take a look at [our example](https://github.com/bufbuild/connect-es/tree/main/packages/example).
Loading