webserver

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 2 Imported by: 1

README

Web Server

Open in Gitpod

tests Go Report Card PkgGoDev

Description

Predefined web server

Usage

srv := New("localhost:45568", func(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(http.StatusOK)
    w.Write([]byte("Hello world"))
})

err := srv.Start()
if err != nil {
    t.Error("server error:", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*http.Server
}

func New

func New(address string, handler func(w http.ResponseWriter, r *http.Request)) *Server

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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