Skip to content

golossus/routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ci workflow codecov Go Report Card CodeFactor Quality Gate Status

Golossus is a set of reusable Go modules to facilitate the creation of web applications leveraging Go's standard packages, mainly net/http.

The routing module exposes a Router or commonly known as Mux to map urls to specific handlers. It provides an enhanced set of features to improve default mux capabilities:

  • Binary tree search for static routes.
  • Allows dynamic routes with parameters.
  • Parameter constraints matching.
  • Http verbs matching.
  • Semantic interface.
  • More to come...

Installation

The routing package is just a common Go module. You can install it as any other Go module. To get more information just review the official Go blog regarding this topic.

Usage

This is just a quick introduction, view the GoDoc for details.

Basic usage example:

package main

import (
    "fmt"
    "net/http"
    "log"

    "github.com/golossus/routing"
)

func Index(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "Welcome!\n")
}

func Hello(w http.ResponseWriter, r *http.Request) {
    ps := routing.GetURLParameters(r)
    fmt.Fprintf(w, "hello, %s!\n", ps.GetByName("name"))
}

func main() {
    router := routing.NewRouter()
    router.Get("/", Index)
    router.Get("/hello/{name}", Hello)

    log.Fatal(http.ListenAndServe(":8080", router))
}

Documentation

Official website is still under construction and documentation is not yet finished. Stay tunned to discover things to come, or subscribe to our newsletter to get direct notifications.

Community

Contributing

Golossus is an Open Source project. The Golossus team wants to enable it to be community-driven and open to contributors. Take a look at contributing documentation.

Security Issues

If you discover a security vulnerability within Golossus, please follow our disclosure procedure.

About Us

Golossus development is led by the Golossus Team Leaders and supported by contributors. It started and supported as a hackweek project at New Work SE, we can just say thank you!