simplehttpserver

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 3 Imported by: 0

README

Simple http server 基于http标准库封装的 静态文件服务

通过http标准库的ServeFile来提供文件和目录的访问服务

使用方法

服务单文件
app.HandleFunc(simplehttpserver.ServeFile("filerealpath"))
服务目录

目录或子目录下如果有index.html.会当成目录正文,否则返回403

app.StripPrefix("'public",simplehttpserver.ServeFolder("folderrealpath))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeFile

func ServeFile(path string) http.HandlerFunc

ServeFile serve given file as http resopnse.

func ServeFolder

func ServeFolder(root string) http.HandlerFunc

ServeFolder serve files in root path as http resopnse. Request folder with index.html will serve as index.html. Request folder without index.html will raise a http forbidden error(403).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL