Skip to content

Javlopez/jrouter

Repository files navigation

CircleCI Build Status Go Report Card codecov Maintainability Test Coverage

jrouter

JRouter is another attemp to make easy the developers life, jrouter is trying to be simple, fast and easy Go http router.

I have started this project recently so please take a look, give me any feedback and open any issue that you have with this router.

Requeriments:

Install dependecy

go get -v https://github.com/Javlopez/jrouter

Basic usage

//main.go
package main

import (
    "github.com/Javlopez/jrouter"
    "log"
    "net/http"
)

func main(){
    jr := New()
    jr.Handle("/some-end-point", HandlerSimpleSample, "GET")
    err := http.ListenAndServe(":8080", jr)
    if err != nil {
        log.Fatalf("Could not start server: %s\n", err.Error())
    }
}

func HandlerSimpleSample(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusOK)
	w.Write([]byte("Hello world"))
}

For more adavanced usage please take a look examples/ folder