The API is not yet stable! Some things will change.
Please wait for a 1.0 release if you're not willing to update your code frequently.
HTTP Server Router
package main
import "github.com/fabysdev/fabyscore-go/server"
import "net/http"
import "fmt"
func main() {
srv := server.New();
srv.GET("/", fabyscoreHandler)
srv.Run(":8080")
}
func fabyscoreHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello!")
}
Only serves files and not the directory.
srv.ServeFiles("/", http.Dir("./"))
net/http
middleware handlers.
package main
import "github.com/fabysdev/fabyscore-go/middleware"
func main() {
timeout := middleware.Timeout(1*time.Second)
}
In-Memory key-value store/cache.
package main
import "github.com/fabysdev/fabyscore-go/cache"
func main() {
// create new cache
c := cache.New()
// add an item
c.Set("key", "value")
// get an item
item, found := c.Get("key")
// delete an item
c.Delete("key")
}
Code and documentation released under the MIT license.