Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings
Unleash

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Is it possible to integrate Proxy API into your own server?#8929

Unanswered
ghettojezuz asked this question inQ&A
Discussion options

Hi there!
I'm new to working with Unleash and feeling a bit confused about how to use it with a proxy.

I have an application that consists of the following parts:

  1. A frontend application built with React.
  2. A Node.js server (using Hapi.js) that acts as a proxy, forwarding requests from the frontend to backend APIs. This server is also responsible for logging, authentication, and other tasks.

I want to integrate the Unleash Proxy into my existing Node.js server instead of deploying a separate one.
For example, I’d like to write something like this:

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!

You must be logged in to vote

Replies: 1 comment

Comment options

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

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@ghettojezuz@gastonfournier

[8]ページ先頭

©2009-2025 Movatter.jp