Comments (12)
I got you . So basically you mean the new module should be a layer above the gateway . I get the idea, but can you just give me some sample so that I will know I am going into the right direction ?
Thanks .
from fastify-gateway.
Hi @parthibd, there are many ways to pre/post process requests using this library.
Can you describe with an example you particular use case so I can offer you a proper solution?
Thanks.
from fastify-gateway.
Say I have two endpoints in two different services /custdetails & /orders . I want to call /user/1/details . What I really want is to call there two endpoints ,get the response and merge them . Is this possible ?
from fastify-gateway.
It is possible, I will get back to you with an example ASAP.
from fastify-gateway.
Thanks a lot . I am planning to add features like loading config from a file ( most probably json/yml?) , adding a service discovery manager .
from fastify-gateway.
Any updates ? :)
from fastify-gateway.
Hi @parthibd, all contributions are welcome here. Of course it would be great to have proper examples and details on your proposals before you actually start working on it.
Thanks for collaborating!
from fastify-gateway.
Say I have a local endpoint like this "/user/:id/details"
Now I want to aggregate I over two service endpoints
{
"path":"/user/:id/details",
"aggregate":true,
"aggregations":[
{
"service":"service1",
"endpoint":"/userdetails/:id"
},
{
"service":"service2",
"endpoint":"/orders/:id"
}
]
}
Is this possible ?
from fastify-gateway.
How should I go about implementing it ?
from fastify-gateway.
I think you missed the target property names on the aggregations endpoints ;)
Such developments can be plug-in into the the proxy hooks:
hooks: {
async onRequest (req, reply) {
// // we can optionally reply from here if required
// reply.send('Hello World!')
//
// return true // truthy value returned will abort the request forwarding
},
onResponse (req, reply, res) {
// do some post-processing here
// ...
// forward response to origin client once finished
reply.send(res)
}
// other options allowed https://github.com/fastify/fastify-reply-from#replyfromsource-opts
}
Here I also believe that such extensions should not land into the core, build them as separated modules. Afterward those will be properly referenced in here.
Thanks.
from fastify-gateway.
Sorry , my bad :) . How should I go ahead to implementing it ? Your guidance will be immensely helpful.
from fastify-gateway.
Create a new module that is able to transform high level routes configurations like you propose into low level k-fastify-gateway
compatibility.
I can create an initial implementation here if you like, as soon as I get some free time.
Regards
from fastify-gateway.
Related Issues (19)
- 5+ seconds response on some status codes < 200ms on others HOT 5
- http methods HOT 1
- feature : HOT 13
- Path parameters? HOT 6
- Trailing slash problem HOT 3
- Service groupings ? HOT 6
- Proxying requests to a domain with a subdirectory HOT 1
- what is shouldAbortProxy in the proxy function ? HOT 1
- Not Found HOT 8
- Prefix + /* doesn't allow for top level routes HOT 6
- Cant send post body HOT 6
- HTTP_HOST being overwritten
- An in-range update of supertest is breaking the build 🚨 HOT 2
- FST_ERR_CTP_INVALID_MEDIA_TYPE: Unsupported Media Type: multipart/form-data; boundary=----WebKitFormBoundaryDtgoTu7ABM7JcOnz
- Manipulating response in onResponse hook HOT 1
- Bump fastify-reply-from dependency to fix critical severity vulnerability HOT 1
- is it stable enough to be used in production? HOT 1
- Error on fastify 4.13.0
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-gateway.