Skip to content
プロジェクト

概要

A simple, zero-configuration HTTP server CLI for serving static files

システム・インフラ

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Go


static-server

Simple static file server, with support of HTTP and HTTPS. Useful for local testing of web applications.

There are no configuration files and no dependencies (except one for testing). Serving the current directory on HTTP port 8080 is as simple as invoking:

$ go run github.com/eliben/static-server@latest
<timestamp> Serving directory "." on http://127.0.0.1:8080

If you want to install static-server locally first, you can run:

$ go install github.com/eliben/static-server@latest

And then invoke static-server as needed. Command-line flags can be used to configure the behavior of the server:

$ static-server -h
Usage: ./static-server [dir]

  [dir] is optional; if not passed, '.' is used.

  By default, the server listens on localhost:8080. Both the
  host and the port are configurable with flags. Set the host
  to something else if you want the server to listen on a
  specific network interface. Setting the port to 0 will
  instruct the server to pick a random available port.

  -addr string
    	full address (host:port) to listen on; don't use this if 'port' or 'host' are set (default "localhost:8080")
  -certfile string
    	TLS certificate file to use with -tls (default "cert.pem")
  -cors
    	enable CORS by returning Access-Control-Allow-Origin header
  -host string
    	specific host to listen on (default "localhost")
  -keyfile string
    	TLS key file to use with -tls (default "key.pem")
  -port string
    	port to listen on; if 0, a random available port will be used (default "8080")
  -silent
    	suppress messages from output (reporting only errors)
  -tls
    	enable HTTPS serving with TLS
  -version
    	print version and exit

関連プロジェクトを探す

読み込み中…