rand / wedge

Wedge is a dead simple Go module to help cut down on boilerplate code when writing webapps in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wedge

Wedge is intended to cut-down on the boilerplate when creating dead simple webapps. There's no super over-the-top functionality in the majority of webapps I've seen yet we all write the same boring code.

Wedge, for the time being, will allow you to write simple functions which do simple things. You need a function on a URL? No problem. You want to easily write a simple JSON response for a URL? No problem! You want to have a multi-tiered RPC cluster with flash failover support and other such magic? Use the standard library and write it yourself, Wedge would not be a good fit.

Usage:

func HelloWorld(req *http.Request) interface{} {
        return "Hello world!"
}

func main() {

    patterns := wedge.Patterns(
            wedge.StaticFiles("/static/", filepath.Join(DIRNAME, "static/")),
            wedge.URL("/jsonhello", "HelloWorld", HelloWorld, wedge.JSON),
            wedge.URL("/", "HelloWorld", HelloWorld, wedge.HTTP),
    )

    wedge.Run(patterns, "12345", 30)
}

About

Wedge is a dead simple Go module to help cut down on boilerplate code when writing webapps in Go