Is it possible to integrate Proxy API into your own server?#8929
-
Hi there! I have an application that consists of the following parts:
I want to integrate the Unleash Proxy into my existing Node.js server instead of deploying a separate one. import{Server,Request,ResponseToolkit}from"@hapi/hapi";import{createApp}from"@unleash/proxy";constunleashApp=createApp({unleashUrl:"https://unleash-url.com/api",unleashApiToken:"server-key",});exportconstregister=(server:Server)=>{server.route({method:["GET","POST"],path:"/unleash/{path*}",handler:async(request:Request,h:ResponseToolkit)=>{constresult=awaitunleashApp(request.raw.req,request.raw.res);returnh.response(result.response);},});};exportconstunleashProxyPlugin={name:"unleashProxyPlugin", register,}; Is it possible to set this up? Any advice or guidance would be greatly appreciated! |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
Hi, we haven't tried that, we were using it with express framework, but it's already deprecated. You can use it if you want and check if you can use it. Our recommendation is to use unleash-edge or use theFrontend API if you don't want to deploy a new server |
BetaWas this translation helpful?Give feedback.