Comments (10)
You should use the plugin interface, not the middleware one. There is plenty of docs in the repo, so there should be all that you need.
All the requirements you are listing can be implemented using the normal fastify API.
Have a look and let us know if you need any specifics details.
from fastify.
I'd seen this start over at Apollo (apollographql/apollo-server#402, apollographql/apollo-server#421). I assume they'll include it eventually since they have an option for micro.
But I wanted to port a project from work that runs with Apollo and express over to fastify. I like the possibilities with hooks for some use cases better than clunky express (authn, authz, graphql context, etc.). mcollina mentioned it as a plugin, so I took a stab at my first OSS project and made fastify-apollo. I hope an Apollo server lines up with fastify's ecosystem.
from fastify.
Hi! Yes it's the expected behavior as you can see here.
The parsing is done after the routing. If you want you can use the preHandler
hook, that gives you everything you need :)
from fastify.
I think you should not use middlewares for integrating with Apollo, but rather develop a full blown plugin for Fastify.
from fastify.
i can investigate also that way, for now i've just followed the structure of other integrations.
can you please give me additional infos on the solution you are thinking about?
as i can see the requirements to make apollo works are:
- ability to intercept only certain paths (
/graphql
and/graphiql
) - ability to access to the
req.body
for POST orreq.query
for GET - ability to set custom headers on the
Reply
- ability to write raw data in the
Reply
stream - ability to close the
Reply
stream
you can also find the actual example usage with the middleware solution here
thanks.
EDIT: that's the original issue that i opened 20 days ago, if you want to add a comment there for some reason.
from fastify.
ok, i'll let you know guys. thanks for the suggestion.
from fastify.
Closing this, feel free to reopen if you have some issues :)
from fastify.
@coopnd this is amazing work! Would you like to send us a PR to the README https://github.com/fastify/fastify#ecosystem
Let us know if you get any bugs in fastify, open them or send PRs.
from fastify.
Awesome, thanks! :)
from fastify.
@coopnd good job! 🚀
from fastify.
Related Issues (20)
- listen() registers a callback even when listen() fails, calling the callback twice - once when it fails and again if it succeeds in a later call HOT 5
- Only automatically run workflows when a member approved them or if the PR is created by a member HOT 2
- app.close only triggers when a new request comes, resulting in 503 error HOT 7
- Missing cookie field in headers of upgrade websocket request HOT 2
- Custom bodyLimit is not taken into account, so fallback on default limit of 1MiB HOT 7
- Suggestion for Fastify 5: Required param to .send HOT 9
- Published packages contain unnecessary files HOT 3
- TypeScript error for FastifyOauth2 HOT 1
- Review on supporting schema shortened HOT 7
- Type Enhancement: Allow `FastifyPluginAsync` to return `void` (not only `Promise<void>`) HOT 2
- feat: add custom http methods HOT 1
- Migrate away from tap in all repositories HOT 5
- Empty `reply.request` in loggers.serializers.res HOT 3
- clarification on when `Reply` object is not fully constructed for `res` serializer
- Disable exposeHeadRoutes by default for fastify v5 HOT 9
- creating codemods for fastify upgrade v4 HOT 2
- Default hostname when providing a nullish `host` in listening options HOT 4
- The stream error of Openai HOT 4
- Plugins specifying a Fastify version restriction that needs updated for v5 HOT 1
- Broken test suite HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify.