64 lines
1.2 KiB
Markdown
64 lines
1.2 KiB
Markdown
# Playground GO
|
|
|
|
A simple web server implementation in Go that demonstrates basic HTTP server concepts.
|
|
|
|
## Overview
|
|
|
|
This project implements a basic HTTP server that:
|
|
- Listens on a specified address and port
|
|
- Handles HTTP requests
|
|
- Processes requests concurrently using goroutines
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── main.go # Application entry point
|
|
├── server/
|
|
│ ├── server.go # Server implementation
|
|
│ └── handler.go # HTTP request handlers
|
|
├── go.mod # Go module definition
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Prerequisites
|
|
|
|
- Go 1.16 or higher
|
|
|
|
## Usage
|
|
|
|
1. Import the server package in your Go code:
|
|
|
|
```go
|
|
import "your-module-name/server"
|
|
```
|
|
|
|
2. Create a new server instance:
|
|
|
|
```go
|
|
server := server.NewServer(":8080") // Listen on port 8080
|
|
```
|
|
|
|
3. Start the server:
|
|
|
|
```go
|
|
server.ListenAndServe()
|
|
```
|
|
|
|
## Features
|
|
|
|
- Concurrent request handling using goroutines
|
|
- HTTP request processing
|
|
- Graceful error handling
|
|
- Simple and clean API design
|
|
|
|
## Error Handling
|
|
|
|
The server includes basic error handling for:
|
|
- Address binding errors
|
|
- Request processing errors
|
|
- HTTP response errors
|
|
|
|
## Contributing
|
|
|
|
Feel free to submit issues and enhancement requests!
|