Skip to content
/ aero Public

🌀 Golang router inspired by the Express Router

License

Notifications You must be signed in to change notification settings

aldidana/aero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aero Go Report Card

Aero is tiny Express-inspired router for golang.

Install

You need go version 1.7++

go get github.com/aldidana/aero

Example

package main

import (
	"fmt"
	"github.com/aldidana/aero"
	"net/http"
)

func main() {
	router := aero.Router()

	router.Get("/", func(res http.ResponseWriter, req *http.Request) {
		res.Write([]byte("Index Page"))
	})

	// Using params
	// This handler will match /hello/bingo but it will not match /hello/ and /hello
	router.Get("/hello/:name", helloHandler)

	http.ListenAndServe(":5678", router)
}

func helloHandler(res http.ResponseWriter, req *http.Request) {
	name := req.Context().Value("name")

	fmt.Fprintf(res, "Hello %v\n", name)
}

TODO

  • Testing
  • Group several routes
  • Maybe route logging 🍻

License

MIT @Aldi Priya Perdana

About

🌀 Golang router inspired by the Express Router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages