Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piterweb/alf-router
🦌 Lightweight Router/Framework built on top of Fasthttp 📦
https://github.com/piterweb/alf-router
alf alf-router api-rest fasthttp fasthttpapi fasthttprouter flutter-api framework go go-api golang microframework router template-engine
Last synced: about 2 months ago
JSON representation
🦌 Lightweight Router/Framework built on top of Fasthttp 📦
- Host: GitHub
- URL: https://github.com/piterweb/alf-router
- Owner: PiterWeb
- License: mit
- Created: 2022-08-08T17:42:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-04T21:35:59.000Z (12 months ago)
- Last Synced: 2024-06-21T02:21:33.361Z (6 months ago)
- Topics: alf, alf-router, api-rest, fasthttp, fasthttpapi, fasthttprouter, flutter-api, framework, go, go-api, golang, microframework, router, template-engine
- Language: Go
- Homepage: https://pkg.go.dev/github.com/PiterWeb/Alf-Router
- Size: 94.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 🦌 ALF (API Like Flutter) Router
#### 🔴 This library is actually well tested but the API may change with the time introducing breaking changes
### Description
👉 This is a micro-framework / router built on ⬆ top of the fasthttp package. Alf relies on scalability and his simple structure wich is similar to Flutter projects 📴
✨ Inspired by Flutter & [Fiber](https://github.com/gofiber/fiber)
## Purpouse
👷♂️ Make a router to start faster and simpler my backend projects
📖 Learn
- Explore the fasthttp package ⏭
- Publish my own package 📦
- Learn more deeply how a web server works 🌐## Technologies used 📘
- Go (Golang)
#### Core External Packages 📦:
1. [fasthttp](github.com/valyala/fasthttp) (http ☁)
2. [ffjson](github.com/pquerna/ffjson/ffjson) (parse interfaces to json fast)
3. [pterm](github.com/pterm/pterm) (show info, errors & warnings)## Features :
- [x] Fast Router 💨
- [x] Concurrent Route Setup ⌚
- [x] Send JSON Responses [(docs)](/utils/json/README.md)
- [x] HTML/Go Templates Out of the BOX ✨ [(docs)](/utils/templates/README.md)
- [x] Plugins 🧩 :
- [x] Generate Types for TS (tygo pkg) [(docs)](/plugins/ts/README.md)## Docs
### Prerequisites 📌
- [Go 1.18](https://go.dev/)
### Set up your first project 💻
Download the package ⬇
```shell
go get github.com/PiterWeb/Alf-Router
```Import it into your code 🔠
```go
import (
alf "github.com/PiterWeb/Alf-Router"
)
```Write this simple structure
```go
err := alf.App(&alf.AppConfig{
Port: "3000",
Routes: alf.CreateRouter([]alf.Route{
{
Path: "/",
Handle: func(ctx *alf.Ctx) error {
_, err := ctx.WriteString("Hello World")
return err
},
Method: "get",
},
}),
})if err != nil {
panic(err)
}
```
Now you have setup 🔨 an index route