Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/litongjava/litongjava-go-simple-http-server
一个简单的go服务器
https://github.com/litongjava/litongjava-go-simple-http-server
Last synced: about 2 months ago
JSON representation
一个简单的go服务器
- Host: GitHub
- URL: https://github.com/litongjava/litongjava-go-simple-http-server
- Owner: litongjava
- License: mit
- Created: 2022-09-17T12:33:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T09:53:21.000Z (5 months ago)
- Last Synced: 2024-08-26T12:12:10.222Z (5 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# litongjava Go Simple HTTP Server
This is a simple HTTP server written in Go that serves static files from a specified directory.
## Features
- Serve static files from a directory.
- Specify the port to listen on.
- Display available IP addresses for accessing the server.## Usage
### Downloading the Release
You can download the latest release of this project from the [GitHub Releases](https://github.com/litongjava/litongjava-go-simple-http-server/releases) page. Choose the release that matches your operating system and architecture.
### Running the Server
After downloading the release, extract the archive (if applicable) and change to the project directory. Then, run the HTTP server using the following command:
```shell
./http-server -port 3000 -dir /path/to/your/directory
```Replace `/path/to/your/directory` with the path to the directory containing the files you want to serve. You can also specify a different port using the `-port` flag (default is 3000).
### Accessing the Server
After starting the server, you can access it in your web browser using one of the displayed IP addresses and the specified port. For example:
- http://127.0.0.1:3000 (localhost)
- http://192.168.0.100:3000 (local network)## Docker
```docker
docker build -t litongjava/http-server:1.0.0 .
``````shell
docker run --rm -p 3000:3000 litongjava/http-server:1.0.0
```
## LicenseThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.