static

package module
v0.0.0-...-aa7c038 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2017 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

echo-static

Build Status Coverage Status Go Report Card GoDoc MIT License

SYNOPSIS

package main

import (
    static "github.com/Code-Hex/echo-static"
 
    assetfs "github.com/elazarl/go-bindata-assetfs"
    "github.com/labstack/echo"
)

func main() {
    e := echo.New()

    e.Use(static.ServeRoot("/static", NewAssets("assets")))
    e.GET("/ping", func(c echo.Context) error {
        return c.String(200, "test")
    })
    // Listen and Server in 0.0.0.0:8080
    e.Start(":8080")
}

func NewAssets(root string) *assetfs.AssetFS {
	return &assetfs.AssetFS{
		Asset:     Asset,
		AssetDir:  AssetDir,
		AssetInfo: AssetInfo,
		Prefix:    root,
	}
}

and put your asset file in the assets directory and execute the following code before compile it.

go-bindata -o bindata.go assets/...

DESCRIPTION

echo-static is File server middleware for go-bindata and echo.

INSTALLATION

go get github.com/Code-Hex/echo-static

AUTHOR

codehex

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryFileSystem

func BinaryFileSystem(fs *assetfs.AssetFS) *binaryFileSystem

func Serve

func Serve(urlPrefix string, fs ServeFileSystem) echo.MiddlewareFunc

Serve Static returns a middleware handler that serves static files in the given directory.

func ServeRoot

func ServeRoot(urlPrefix string, fs *assetfs.AssetFS) echo.MiddlewareFunc

Types

type ServeFileSystem

type ServeFileSystem interface {
	http.FileSystem
	Exists(prefix string, path string) bool
}

ServeFileSystem

Jump to

Keyboard shortcuts

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