eznodefiber

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

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

Go to latest
Published: Dec 10, 2022 License: MIT Imports: 10 Imported by: 0

README

eznode-fiber

ready to use http version of eznode. it setup everything you need to create http client of eznode.

example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoute

func RegisterRoute(app *fiber.App, e *eznode.EzNode, routePrefix string, logLevel logrus.Level)

RegisterRouter register a router on instance of fiber for proxy request to eznode and send response to user it registers a route with prefix which it accepts request and routes it to eznode for example: RegisterRoute(app, e, "/test-eznode", logrus.DebugLevel), it does register `/test-eznode/:chainId` on fiber app instance. request can be sent to desired chain with this route for example: GET `/test-eznode/ethereum` IMPORTANT NOTE: chainId is what you set in your eznode instance

func StartFiber

func StartFiber(port int, e *eznode.EzNode, logLevel logrus.Level) error

StartFiber start a fiber app with a port to listen on default routes:

  • ANY `/:chainId`: route to connect to eznode with chainId, you request to your specific node with the chainId which you have set in the eznode instance. for example: GET `/ethereum` IMPORTANT NOTE: chainId is what you set in your eznode instance
  • POST `/manage/disable-node`: disable a node, accept DisableNodeRequest as body
  • POST `/manage/enable-node`: enable a node, accept EnableNodeRequest as body

Types

type DisableNodeRequest

type DisableNodeRequest struct {
	ChainId  string `json:"chain_id"`
	NodeName string `json:"node_name"`
	WithTime int    `json:"with_time"`
}

DisableNodeRequest disable node request body

type EnableNodeRequest

type EnableNodeRequest struct {
	ChainId  string `json:"chain_id"`
	NodeName string `json:"node_name"`
}

EnableNodeRequest enable node request body

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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