{"id":21711600,"url":"https://github.com/heliolj/http-server-go","last_synced_at":"2025-03-20T18:20:48.604Z","repository":{"id":248191084,"uuid":"828022502","full_name":"helioLJ/http-server-go","owner":"helioLJ","description":"A HTTP server written in Go that's capable of handling simple GET/POST requests, serving files and handling multiple concurrent connections.","archived":false,"fork":false,"pushed_at":"2024-07-12T23:14:40.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T16:44:20.189Z","etag":null,"topics":["go","golang","http","http-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helioLJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-12T23:00:09.000Z","updated_at":"2024-07-12T23:14:54.000Z","dependencies_parsed_at":"2024-07-13T00:41:45.940Z","dependency_job_id":null,"html_url":"https://github.com/helioLJ/http-server-go","commit_stats":null,"previous_names":["heliolj/http-server-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helioLJ%2Fhttp-server-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helioLJ%2Fhttp-server-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helioLJ%2Fhttp-server-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helioLJ%2Fhttp-server-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helioLJ","download_url":"https://codeload.github.com/helioLJ/http-server-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244666588,"owners_count":20490288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","http","http-server"],"created_at":"2024-11-25T23:28:10.753Z","updated_at":"2025-03-20T18:20:48.571Z","avatar_url":"https://github.com/helioLJ.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go HTTP Server\n\nThis is a simple HTTP server written in Go that handles various types of requests and supports concurrent connections.\n\n## Features\n\n- Handles GET and POST requests\n- Supports concurrent connections\n- Implements several endpoints:\n- Root endpoint (`/`)\n- Echo endpoint (`/echo/\u003cmessage\u003e`)\n- User-Agent endpoint (`/user-agent`)\n- File handling endpoints (`/files/\u003cfilename\u003e`)\n- Supports gzip compression for responses\n- Logs incoming requests and their statuses\n\n## Prerequisites\n\n- Go 1.16 or higher\n\n## Installation\n\n1. Clone this repository:\ngit clone https://github.com/helioLJ/http-server-go.git\ncd http-server-go\n\n\n2. Build the server:\n./start_server.sh\n\n\n## Usage\n\n### Starting the Server\n\nRun the server using the start script:\n\n./start_server.sh [--directory \u003cpath\u003e]\n\n\nThe `--directory` flag is optional and specifies the directory for file operations. If not provided, the current directory will be used.\n\n### Endpoints\n\n1. **Root Endpoint (`/`)**\n   - Returns a 200 OK status with an empty body.\n\n2. **Echo Endpoint (`/echo/\u003cmessage\u003e`)**\n   - Returns the `\u003cmessage\u003e` in the response body.\n\n3. **User-Agent Endpoint (`/user-agent`)**\n   - Returns the User-Agent header from the request.\n\n4. **File Handling Endpoints (`/files/\u003cfilename\u003e`)**\n   - GET: Retrieves the content of the specified file.\n   - POST: Creates a new file with the specified name and content.\n\n### Concurrent Connections\n\nThe server supports handling multiple connections concurrently. You can test this using the provided `concurrent_connections.sh` script:\n\n./concurrent_connections.sh\n\n\nThis script sends three concurrent requests to the server.\n\n## Configuration\n\nThe server listens on port 4221 by default. To change this, modify the `net.Listen()` call in the `main()` function of `server.go`.\n\n## Logging\n\nThe server logs each request with the following information:\n- Timestamp\n- Remote address\n- HTTP method\n- Requested path\n- Response status\n\nLogs are printed to the console.\n\n## Roadmap\n\n1. Implement unit tests for all major functions:\n   - Test request handling for different endpoints\n   - Test file operations\n   - Test concurrent connections\n   - Test gzip compression\n\n2. Add support for HTTPS\n\n3. Implement request logging to a file\n\n4. Add configuration file support for server settings\n\n5. Implement basic authentication for certain endpoints\n\n6. Add support for serving static files\n\n7. Implement rate limiting\n\n8. Add support for WebSocket connections\n\n9. Implement a simple routing system for easier endpoint management\n\n10. Add support for JSON responses\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheliolj%2Fhttp-server-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheliolj%2Fhttp-server-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheliolj%2Fhttp-server-go/lists"}