Skip to content

Commit

Permalink
updated fastify plugin to work with fastify v5
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Oct 12, 2024
1 parent 49ed9bf commit 239c569
Show file tree
Hide file tree
Showing 5 changed files with 552 additions and 13 deletions.
26 changes: 26 additions & 0 deletions examples/fastify-v5/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { AltairFastify } from '../../packages/altair-fastify-plugin/dist';

// const Fastify = require("fastify");
import Fastify from 'fastify';
// const AltairFastify = require("altair-fastify-plugin");
// import AltairFastify from 'altair-fastify-plugin';

const app = Fastify();

// ...

app.register(AltairFastify, {
/**
* All these are the defaults.
*/
path: '/altair',
baseURL: '/altair/',
endpointURL: '/graphql',
});

// ...

// Altair available at localhost:3000/altair
app.listen({ port: 3000 }, () => {
console.log('Server listening at http://localhost:3000');
});
17 changes: 17 additions & 0 deletions examples/fastify-v5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "fastify-v4",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@types/node": "^22.7.4",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"dependencies": {
"fastify": "^5.0.0"
},
"scripts": {
"start": "ts-node index.ts"
}
}
Loading

0 comments on commit 239c569

Please sign in to comment.