transport

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

http.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPHandler

func NewHTTPHandler(endpoints endpoint.Endpoints) http.Handler

NewHTTPHandler returns a new HTTP handler that routes incoming requests to the appropriate endpoints. It takes an `endpoints` parameter of type `endpoint.Endpoints` which contains the implementation of various endpoints. The handler is responsible for mapping the incoming HTTP requests to the corresponding endpoint functions. It returns an `http.Handler` that can be used to serve the HTTP requests.

func NewHTTPServer

func NewHTTPServer(addr string, handler http.Handler)

NewHTTPServer creates a new HTTP server that listens on the specified address and handles requests using the provided handler.

Parameters: - addr: The address to listen on (e.g., "localhost:8080"). - handler: The http.Handler to handle incoming requests.

Example usage:

NewHTTPServer("localhost:8080", myHandler)

Note: This function blocks indefinitely, so it should typically be called in a separate goroutine.

Types

This section is empty.

Jump to

Keyboard shortcuts

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