basic-http-server

command
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

Basic HTTP Server with Authentication

This example demonstrates how to create an HTTP server with basic authentication.

Running the Example

go run github.com/dioad/net/examples/basic-http-server

Or build and run:

cd examples/basic-http-server
go build
./basic-http-server

Then test with:

curl -u user1:password1 http://localhost:8080/protected

What It Demonstrates

  • Creating a basic authentication map with username/password
  • Setting up an HTTP server with basic auth middleware
  • Protecting specific routes with authentication
  • Graceful shutdown handling

Code

See main.go for the complete executable example.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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