Socket
Book a DemoInstallSign in
Socket

h3-proxy

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h3-proxy

A proxy event handler for h3, using proxyRequest.

Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
995
-33.62%
Maintainers
1
Weekly downloads
 
Created
Source


h3-proxy

A proxy event handler for h3, using proxyRequest.

Features

  • Powerd by built-in proxyRequest of h3.
  • Support Typescript.

Installation

# pnpm
$ pnpm add h3-proxy

# yarn
$ yarn add h3-proxy

# npm
$ npm i h3-proxy

Usage

import { createServer } from 'node:http'
import { createApp, eventHandler, toNodeListener } from 'h3'
import { createProxyEventHandler } from 'h3-proxy'

const app = createApp()

const proxyEventHandler = createProxyEventHandler({
  target: 'http://127.0.0.1:3000',
  pathRewrite: {
    '/api': '',
  },
  pathFilter: ['/api/**'],
})

app.use(
  '/test',
  eventHandler(() => 'Hello world!')
)

app.use(eventHandler(proxyEventHandler))

createServer(toNodeListener(app)).listen(process.env.PORT || 3000)

APIs

createProxyEventHandler

Create a h3 event handler that can handle proxy requests.

CHANGE LOG

SEE CHANGE LOG.

Keywords

h3

FAQs

Package last updated on 15 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts