Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sundowndev/serve
Simple, production ready, HTTP server for static file serving
https://github.com/sundowndev/serve
http-server production-ready static-file static-server
Last synced: 2 months ago
JSON representation
Simple, production ready, HTTP server for static file serving
- Host: GitHub
- URL: https://github.com/sundowndev/serve
- Owner: sundowndev
- License: mit
- Created: 2020-05-03T12:48:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-01T09:52:32.000Z (over 1 year ago)
- Last Synced: 2024-06-20T02:11:13.319Z (6 months ago)
- Topics: http-server, production-ready, static-file, static-server
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serve
![action](https://img.shields.io/endpoint.svg?url=https://actions-badge.atrox.dev/sundowndev/serve/badge?ref=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/sundowndev/serve)](https://goreportcard.com/report/github.com/sundowndev/serve)
![release](https://img.shields.io/github/release/SundownDEV/serve.svg)Lightweight, simple, production ready HTTP server for static file serving.
## Installation
```
# Download the archive
$ curl -L "https://github.com/sundowndev/serve/releases/download/v1.1.0/serve_$(uname -s)_$(uname -m).tar.gz" -o serve.tar.gz# Extract the binary
$ tar xfv serve.tar.gz# Run the software
$ ./serve -h# You can install it globally
$ mv ./serve /usr/bin/serve
```If the installation fails, it probably means your OS/arch is not suppored.
Please check the output of echo "$(uname -s)_$(uname -m)" in your terminal and see if it's available on the [GitHub release page](https://github.com/sundowndev/serve/releases).
## Usage
Here's the help message :
```
$ serve -hUsage of http_server:
-addr string
The address to listen to.
-port string
The port to listen to.
-prefix string
The URI prefix path.
-root string
the directory to serve files from.
```Launch a HTTP server to serve files in the current directory :
```
$ serve -root . -port 8080
```### Docker image
Launch a HTTP server to serve files in the `public` directory :
```
$ docker run -it --rm -v $PWD/public:/app/public:ro -p 80:80 sundowndev/serve -root public
```#### Using compose
```yml
version: '3.7'services:
serve:
container_name: serve
restart: on-failure
image: sundowndev/serve:latest
command: "-root ./public"
volumes:
- ./fixtures:/app/public:ro
ports:
- "80:80"
```## License
This project is MIT Licensed.