pocketbase_plugin_ngrok

package module
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 8 Imported by: 0

README

Test codecov

Overview

This plugin allow proxify requests to other host. It can be useful if you want to use separate server as frontend but use one address for both frontend and backend.

Requirements

Installation

go get github.com/iamelevich/pocketbase-plugin-proxy

Example

You can check examples in examples folder

package main

import (
	"log"

	proxyPlugin "github.com/iamelevich/pocketbase-plugin-proxy"
	"github.com/pocketbase/pocketbase"
)

func main() {
	app := pocketbase.New()

	// Setup ngrok
	proxyPlugin.MustRegister(app, &proxyPlugin.Options{
		Enabled: true,
		Url:     "http://localhost:3000",
	})

	if err := app.Start(); err != nil {
		log.Fatal(err)
	}
}

Contributing

This pocketbase plugin is free and open source project licensed under the MIT License. You are free to do whatever you want with it, even offering it as a paid service.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Enabled defines if proxy should be enabled.
	Enabled bool

	// Url to the target
	Url string

	// Are proxy logs enabled?
	ProxyLogsEnabled bool
}

Options defines optional struct to customize the default plugin behavior.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func MustRegister

func MustRegister(app core.App, options *Options) *Plugin

MustRegister is a helper function that registers plugin and panics if error occurred.

func Register

func Register(app core.App, options *Options) (*Plugin, error)

Register registers plugin.

func (*Plugin) Validate

func (p *Plugin) Validate() error

Directories

Path Synopsis
examples
base command

Jump to

Keyboard shortcuts

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