Skip to content

Commit b86f219

Browse files
itssimonCopilot
andauthored
Add support for AdonisJS (#83)
* WIP * WIP * WIP * WIP * Fix attw * Fix order * Fix order again * WIP * Update README and tests workflow * Fix * Capture VineJS validation errors * Fix * Fix typo Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 6779c71 commit b86f219

File tree

15 files changed

+2665
-41
lines changed

15 files changed

+2665
-41
lines changed

.github/workflows/tests.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ jobs:
7676
7777
7878
79+
- "@adonisjs/[email protected]"
80+
- "@adonisjs/[email protected]"
7981
steps:
8082
- uses: actions/checkout@v4
8183
- uses: actions/setup-node@v4
@@ -101,3 +103,6 @@ jobs:
101103
- name: Run tests for Hono
102104
run: npm test -- tests/hono
103105
if: contains(matrix.deps, 'hono')
106+
- name: Run tests for AdonisJS
107+
run: npm test -- tests/adonisjs
108+
if: contains(matrix.deps, 'adonisjs')

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ frameworks:
3131
- [Fastify](https://docs.apitally.io/frameworks/fastify)
3232
- [Koa](https://docs.apitally.io/frameworks/koa)
3333
- [Hono](https://docs.apitally.io/frameworks/hono)
34+
- [AdonisJS](https://docs.apitally.io/frameworks/adonisjs)
3435

3536
Learn more about Apitally on our 🌎 [website](https://apitally.io) or check out
3637
the 📚 [documentation](https://docs.apitally.io).
@@ -183,6 +184,46 @@ useApitally(app, {
183184
});
184185
```
185186

187+
### AdonisJS
188+
189+
This is an example of how to use the Apitally middleware with a AdonisJS application.
190+
For further instructions, see our
191+
[setup guide for AdonisJS](https://docs.apitally.io/frameworks/adonisjs).
192+
193+
Create a configuration file at `config/apitally.ts`:
194+
195+
```javascript
196+
import { defineConfig } from "apitally/adonisjs";
197+
198+
const apitallyConfig = defineConfig({
199+
clientId: "your-client-id",
200+
env: "dev", // or "prod" etc.
201+
});
202+
203+
export default apitallyConfig;
204+
```
205+
206+
Register the Apitally provider in your `adonisrc.ts` file:
207+
208+
```javascript
209+
export default defineConfig({
210+
// ... existing code ...
211+
providers: [
212+
// ... existing providers ...
213+
() => import("apitally/adonisjs/provider"),
214+
],
215+
});
216+
```
217+
218+
Register the Apitally middleware in your `start/kernel.ts` file:
219+
220+
```javascript
221+
router.use([
222+
() => import("apitally/adonisjs/middleware"),
223+
// ... other middleware ...
224+
]);
225+
```
226+
186227
## Getting help
187228

188229
If you need help please [create a new discussion](https://github.com/orgs/apitally/discussions/categories/q-a) on GitHub

0 commit comments

Comments
 (0)