apitally 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +12 -2
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -109,7 +109,7 @@ This is an example of how to register the Apitally plugin with a Fastify
109
109
  application. For further instructions, see our
110
110
  [setup guide for Fastify](https://docs.apitally.io/frameworks/fastify).
111
111
 
112
- _Note:_ The Apitally plugin requires the
112
+ The Apitally plugin requires the
113
113
  [`fastify-plugin`](https://www.npmjs.com/package/fastify-plugin) package to be
114
114
  installed.
115
115
 
@@ -121,12 +121,22 @@ npm install fastify-plugin
121
121
  const fastify = require("fastify")({ logger: true });
122
122
  const { apitallyPlugin } = require("apitally/fastify");
123
123
 
124
- await fastify.register(apitallyPlugin, {
124
+ fastify.register(apitallyPlugin, {
125
125
  clientId: "your-client-id",
126
126
  env: "dev", // or "prod" etc.
127
127
  });
128
+
129
+ // Wrap your routes in a plugin, so Apitally can detect them
130
+ fastify.register((instance, opts, done) => {
131
+ instance.get("/", (request, reply) => {
132
+ reply.send("hello");
133
+ });
134
+ done();
135
+ });
128
136
  ```
129
137
 
138
+ _Note:_ If your project uses ES modules you can use `await fastify.register(...)` and don't need to wrap your routes in a plugin. See the [Fastify V4 migration guide](https://fastify.dev/docs/latest/Guides/Migration-Guide-V4/#synchronous-route-definitions-2954) for more details.
139
+
130
140
  ### Koa
131
141
 
132
142
  This is an example of how to use the Apitally middleware with a Koa application.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apitally",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Simple API monitoring and API key management for REST APIs built with Express, Fastify, Koa, and NestJS.",
5
5
  "author": "Apitally <hello@apitally.io>",
6
6
  "license": "MIT",
@@ -153,6 +153,7 @@
153
153
  "sourceMaps": true
154
154
  },
155
155
  "dependencies": {
156
+ "@babel/runtime": "^7.23.8",
156
157
  "axios": "^1",
157
158
  "axios-retry": "^4",
158
159
  "winston": "^3"