# README
Introduction
ššš lightning is a lightweight and fast web framework for Go. It is designed to be easy to use and highly performant.
Features
- Easy to use and quick to get started
- Supports middleware
- Fast routing, with routing algorithm implemented based on Trie tree
- Support for grouping routes and applying middleware to specific groups
- Customizable 404 Not Found and 500 Internal Server Error handler functions
Getting Started
To get started with lightning, simply install it using go get:
go get github.com/go-labx/lightning
Then, create a new lightning app and start adding routes:
package main
import (
"github.com/go-labx/lightning"
"net/http"
)
func main() {
app := lightning.DefaultApp()
app.Get("/ping", func(ctx *lightning.Context) {
ctx.JSON(http.StatusOK, lightning.Map{
"message": "pong",
})
})
app.Run()
}
To run the lightning app, run the following command:
go run app.go
To verify that the server has started successfully, run the following command in your terminal:
curl http://127.0.0.1:6789/ping
Documentation
For more information on how to use lightning, check out the documentation.
Contributing
If you'd like to contribute to lightning, please see CONTRIBUTING.md for guidelines.
License
lightning is licensed under the MIT License.
# Packages
No description provided by the author
# Functions
DefaultApp returns a new instance of the Application struct with default middlewares.
Logger returns a middleware function that logs incoming requests.
NewApp returns a new instance of the Application struct.
NewContext creates a new context object with the given HTTP response writer and req.
Recovery returns a middleware that recovers from panics and sends a 500 response with an error message.
# Constants
Header keys.
Header keys.
MIME types.
MIME types.
MIME types.
MIME types.
# Structs
No description provided by the author
No description provided by the author
Context represents the context of an HTTP request/response.
Group represents a group of routes with a common prefix and middleware.
# Type aliases
HandlerFunc is a function type that represents the actual handler function for a route.
No description provided by the author
No description provided by the author
Map is a shortcut for map[string]interface{}.
No description provided by the author