No description
Find a file
2025-06-11 16:34:13 -04:00
handlers re-write with std usage of net/http 2025-06-11 15:49:47 -04:00
internal/config re-write with std usage of net/http 2025-06-11 15:49:47 -04:00
logger apply loglevel color to timestamp 2025-06-11 16:34:13 -04:00
middleware re-write with std usage of net/http 2025-06-11 15:49:47 -04:00
static re-write with std usage of net/http 2025-06-11 15:49:47 -04:00
.gitignore Initial commit 2025-06-11 18:22:50 +00:00
go.mod go for it 2025-06-11 14:44:52 -04:00
main.go re-write with std usage of net/http 2025-06-11 15:49:47 -04:00
README.md oops wrong default port 2025-06-11 15:51:45 -04:00

Playground GO

A modern web server implementation in Go that demonstrates production-ready HTTP server concepts.

Overview

This project implements a robust HTTP server that:

  • Listens on a configurable port
  • Handles HTTP requests with a custom router
  • Processes requests concurrently using goroutines
  • Implements middleware for logging and request processing
  • Provides graceful shutdown capabilities
  • Uses structured logging
  • Follows clean architecture principles

Project Structure

.
├── main.go         # Application entry point
├── handlers/       # HTTP request handlers
├── middleware/     # HTTP middleware components
├── logger/         # Structured logging implementation
├── internal/       # Internal packages and configuration
├── static/         # Static file serving
├── go.mod          # Go module definition
├── .gitignore      # Git ignore rules
└── README.md       # This file

Prerequisites

  • Go 1.16 or higher

Usage

  1. Clone the repository:
git clone https://github.com/yourusername/playground-go.git
cd playground-go
  1. Run the server:
go run main.go

The server will start on the configured port (default: 7878).

Features

  • Concurrent request handling using goroutines
  • Graceful server shutdown
  • Structured logging
  • Middleware support for request processing
  • Configuration management
  • Clean architecture with separated concerns
  • Static file serving
  • Error handling and logging

Configuration

The server can be configured through environment variables:

  • PORT: The port number to listen on (default: 7878)
  • Additional configuration options can be added in the internal/config package

Error Handling

The server includes comprehensive error handling for:

  • Server startup and shutdown
  • Request processing
  • Configuration loading
  • Graceful shutdown with timeout
  • Structured error logging

Contributing

Feel free to submit issues and enhancement requests! When contributing, please:

  1. Fork the repository
  2. Create a new branch for your feature
  3. Submit a pull request with a clear description of your changes