Welcome to the Simple Go HTTP Server project! This repository contains a basic Go HTTP server that you can use as a starting point for your own projects. Follow the steps below to set up and run the server.
Before you begin, ensure you have the following installed on your system:
- Go
- Git
-
Clone this repository to your local machine:
git clone https://github.com/your-username/go-http-server.git
-
In the
config
folder, renameconfigs.yaml.sample
toconfigs.yaml
and fill in the necessary configuration fields based on your usage.
-
Use the provided Makefile to download and vendor dependencies, and build the project:
make all
-
Run the following command to start the HTTP server:
./go-http-server serve
-
The server is now running! You can access it at
localhost:port
whereport
is the port you specified in theconfigs.yaml
file.
The server comes with a simple example endpoint:
- GET request to
localhost:port/ping
will return an HTML file with the body "Pong."
The project has the following structure:
.
├── Makefile
├── config
│ ├── config.go
│ ├── configs.yaml
│ └── configs.yaml.sample
├── go.mod
├── main.go
├── server
│ └── panel
│ └── html
│ ├── 404.html
│ └── ping.html
└── src
├── main
│ └── cli
│ ├── root.go
│ └── serve.go
├── middleware
│ ├── middleware.go
│ └── ports.go
├── modules
│ └── panel
│ ├── delete.go
│ ├── get.go
│ ├── main_handler.go
│ ├── ports.go
│ ├── post.go
│ ├── put.go
│ └── response.go
└── service
├── providers
│ ├── http_server.go
│ └── ports.go
└── wiring
├── service.go
└── wiring.go
Feel free to contribute to this project by submitting pull requests or reporting issues. Your contributions are greatly appreciated!
This project is licensed under the MIT License.
Happy coding!