

syntaqx/serve: a static http server anywhere you need one
source link: https://www.tuicool.com/articles/hit/Mvim22e
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

serve
is a static http server anywhere you need one.
TL;DR
It's basically python -m SimpleHTTPServer 8080
written in Go, because who can remember that many letters?
Installation
serve
can be installed in a handeful of ways:
Homebrew on macOS
If you are using Homebrew on macOS, you can install serve
with the following command:
brew install syntaqx/tap/serve
Download the binary
Quickly download install the latest release:
curl -sfL https://install.goreleaser.com/github.com/syntaqx/serve.sh | sh
Or manually download the latest release binary for your system and architecture and install it into your $PATH
.
From source
To build from source, check out the instructions on getting started with.
Usage
Run a server from the current directory:
serve
Or, specify the directory. Paths can be both relative and absolute:
serve /var/www # or serve -dir=/var/www
Development
To develop serve
or interact with its source code in any meaningful way, be sure you have the following installed:
Prerequisites
You will need to activate Modules for your version of Go, generally by invoking go
with the support GO111MODULE=on
environment variable set.
Install
You can download and install the project from GitHub by simply running:
git clone [email protected]:syntaqx/serve.git && cd $(basename $_ .git) make install
This will install serve
into your $GOPATH/bin
directory, which assuming is properly appended to your $PATH
, can now be used:
$ serve version serve version v0.0.6-8-g5074d63 windows/amd64
Using serve
manually
Besides running serve
using the provided binary, you can also embed a serve.FileServer
into your own Go program:
package main import ( "log" "net/http" "github.com/syntaqx/serve" ) func main() { fs := serve.NewFileServer() log.Fatal(http.ListenAndServe(":8080", fs)) }
License
serve
is open source software released under the MIT license .
Recommend
-
62
README.md ...
-
12
Conversation Contributor ...
-
7
Serve ML.NET Models as HTTP APIs with minimal configurationMarch 1st...
-
10
Nick Scialli • March 07, 2021 • 🚀 4 minute read
-
12
↞ Back The smallest Docker image to serve static websites Until recently, I used to think that serving static websites from Docker would be a waste of bandwith an...
-
8
GOTTP SERVER Gottp is an HTTP server that can be used to serve static files and make simple API routes. It provides an abstraction on top of the built in http package to get up and running in no time. INSTALLATION
-
2
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
-
8
How to Serve Static Assets with an Efficient Cache Policy on WordPress Updated on June 6, 2023 - Jen Swisher One of the hallmarks of a user-friendly website is that it doesn’t keep visitors waiti...
-
9
...
-
10
One of the handiest new features included in the Java 18 release (March 2022) was the new Simple Web Server, which makes it easy to spi...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK