command
Version:
v0.53.0
Opens a new window with list of versions in this module.
Published: Jan 19, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
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
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.