Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arl/serve
Serves the content of a directory as HTTP.
https://github.com/arl/serve
fileserver go golang http serve server simple simplehttpserver
Last synced: about 8 hours ago
JSON representation
Serves the content of a directory as HTTP.
- Host: GitHub
- URL: https://github.com/arl/serve
- Owner: arl
- Created: 2020-08-30T17:06:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-07T18:06:00.000Z (about 1 year ago)
- Last Synced: 2024-11-30T13:49:32.547Z (about 2 months ago)
- Topics: fileserver, go, golang, http, serve, server, simple, simplehttpserver
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serve
Like `python -m SimpleHTTPServer` but even _simpler_!
## Installation
go install github.com/arl/serve@latest
## Usage
$ serve -h
Serves the content of a directory as HTTP
usage: serve [-h] [addr] [dir]
options:
addr Address to listen on. Defaults to "localhost:8000"
Format is host:port where "host" can be omitted to listen on all
network interfaces.
dir File server root directory, defaults to current directory
-h/--help Show this messageOnce started, `serve` logs HTTP requests as follows:
$ serve
[serve] serving . on http://localhost:8000/
[serve] "GET / HTTP/1.1" 0 7 58.398µs
[serve] "GET /index.html HTTP/1.1" 200 1592 3.958531ms
[serve] "GET /main.css HTTP/1.1" 200 821 109.286µsFor example, the last line indicates that an `HTTP/1.1` request to `main.css` has been served, it ended with a 200 status, 821 bytes were served and that took 109µs.
## Examples
* Serves current directory on defaut address `http://localhost:8000`
```
serve
```* Serves current directory on `http://*:80` (all network interfaces)
```
serve :80
```* Serves `/foo/bar` directory on `http://*:7777` (all network interfaces)
```
serve :7777 /foo/bar
```