@@ -18,6 +18,14 @@ This library also supports legacy services hosted by [Fanout](https://fanout.io/
1818
1919Authors: Katsuyuki Omuro
< [email protected] > , Konstantin Bokarius
< [email protected] > 2020
21+ ## New for v2
22+
23+ ### Breaking changes
24+
25+ - Simplified build, now exported as ESM modules only. If you require CommonJS support or
26+ a browser build, use v1.
27+ - A number of classes and interfaces have been removed for simplification.
28+
2129### Introduction
2230
2331[ GRIP] ( https://pushpin.org/docs/protocols/grip/ ) is a protocol that enables a web service to
@@ -30,7 +38,7 @@ Next.js. It:
3038* provides your route handler with tools to handle such requests, such as:
3139 * access to information about whether the current request is proxied or is signed
3240 * methods you can call to issue any instructions to the GRIP proxy
33- * provides access to the the publisher object, enabling your application to publish messages through
41+ * provides access to the ` Publisher ` object, enabling your application to publish messages through
3442 the GRIP publisher.
3543
3644Additionally, ` serve-grip ` also handles
@@ -152,10 +160,18 @@ middleware in a shared location and reference it from your API routes.
152160
153161### Configuration
154162
155- ` @fanoutio/serve-grip ` exports a constructor function, ` ServeGrip ` . This constructor takes a
163+ ` @fanoutio/serve-grip/node ` exports a constructor function, ` ServeGrip ` . This constructor takes a
156164configuration object that can be used to configure the instance, such as the GRIP proxies to use
157165for publishing or whether incoming requests should require a GRIP proxy.
158166
167+ > [ !IMPORTANT]
168+ > ` ServeGrip ` is a subclass of ` ServeGripBase ` that works with ` IncomingRequest ` and ` ServerResponse `
169+ > classes provided by Node.js. ` ServeGrip ` is also available on the main ` @fanoutio/serve-grip ` export
170+ > when the condition ` "node" ` is present when resolving imports (the default in Node.js applications).
171+ >
172+ > This design allows non-Node.js platforms (such as [ Expressly] ( https://expressly.edgecompute.app ) ) to
173+ > extend ` ServeGripBase ` without holding a dependency on types provided by Node.js.
174+
159175The following is an example of configuration against Pushpin running on localhost:
160176``` javascript
161177import { ServeGrip } from ' @fanoutio/serve-grip' ;
@@ -316,3 +332,9 @@ If you have used `express-grip` in the past, you will notice that this library n
316332requires the use of pre-route and post-route middlewares. Consequently, you do not need to
317333call ` next() ` for route handlers that complete their work. In fact, you should follow the
318334standard practice of calling ` res.end() ` at the end of each of your route handlers.
335+
336+ ## License
337+
338+ (C) 2015, 2020 Fanout, Inc.
339+ (C) 2024 Fastly, Inc.
340+ Licensed under the MIT License, see file LICENSE.md for details.
0 commit comments