proxy

package module
v0.0.0-...-d41b86b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

jsonapi-reverse-proxy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReverseProxyHandler

type ReverseProxyHandler struct {
	jsonapi.URLResolver              // The URL resolver.
	BaseURL             string       // The base URL of the JSON:API server.
	Client              jsonapi.Doer // The HTTP client.
}

ReverseProxyHandler is a handler that forwards client requests to the JSON:API server at the given base URL.

func NewReverseProxyHandler

func NewReverseProxyHandler(baseURL string, options ...func(*ReverseProxyHandler)) ReverseProxyHandler

NewReverseProxyHandler creates a new reverse proxy handler. This handler forwards client requests to the JSON:API server at the given base URL.

By default, NewReverseProxyHandler generates the following urls (given a base url):

":base/:type" for search, create
":base/:type/:id" for fetch, update, delete
":base/:type/:id/relationships/:ref" for fetchRef
":base/:type/:id/:ref" for fetchRelated

This behavior can be modified by updating the URLResolver field of a ReverseProxyHandler instance.

func (ReverseProxyHandler) ServeJSONAPI

func (p ReverseProxyHandler) ServeJSONAPI(r *http.Request) jsonapi.Response

ServeJSONAPI forwards the request to the JSON:API server at the given base URL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL