Home

Awesome

static

Build Status Coverage Status Go Report Card

lu static file serving middleware, based on fasthttp.FS.

example

package main

import (
	"log"
	
	"github.com/valyala/fasthttp"
	"github.com/vincentLiuxiang/lu"
 	"github.com/lugolang/static"
)

func main() {
	app := lu.New()
	fs := static.DefaultFS
	// fs.Root = "/static/file/path/"
	Static := static.New(fs)
	app.Get("/static", Static)
	server := &fasthttp.Server{
		Handler:       app.Handler,
		Concurrency:   1024 * 1024,
		Name:          "lu",
		MaxConnsPerIP: 50,
	}
	if err := server.ListenAndServe(":8080"); err != nil {
		log.Fatalf("error in lu server: %s", err)
	}
}

the config of fs is totally same with fasthttp.FS

fs.Root string

fs.IndexNames []string