router_utils

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MIT Imports: 5 Imported by: 0

README

Usage

import (
    "github.com/gorilla/mux"
)

func Router() {
    r := mux.NewRouter()
    
    router_utils.SetStaticPath(your_static_path)
    router_utils.SetNotFoundHandler(your_not_found_handler)

    r.NotFoundHandler = http.HandlerFunc(router_utils.Static)

    // ...
}
router_utils.ExecTemplate(
    w, 
    "index.html", 
    data, // interface{} 
    "./views/index.html", "./views/header.html", "./views/footer.html",
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecTemplate

func ExecTemplate(w http.ResponseWriter, templateName string, data interface{}, filenames ...string) (err error)

func SetNotFoundHandler

func SetNotFoundHandler(notfoundHandler func(w http.ResponseWriter, r *http.Request))

func SetStaticPath

func SetStaticPath(path string)

func Static

func Static(w http.ResponseWriter, r *http.Request)

Types

This section is empty.

Jump to

Keyboard shortcuts

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