Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 1.83 KB

README.md

File metadata and controls

83 lines (58 loc) · 1.83 KB

🦌 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

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 (http ☁)
  2. ffjson (parse interfaces to json fast)
  3. pterm (show info, errors & warnings)

Features :

  • Fast Router 💨
  • Concurrent Route Setup ⌚
  • Send JSON Responses (docs)
  • HTML/Go Templates Out of the BOX ✨ (docs)
  • Plugins 🧩 :
    • Generate Types for TS (tygo pkg) (docs)

Docs

Prerequisites 📌

Set up your first project 💻

Download the package ⬇

go get github.com/PiterWeb/Alf-Router

Import it into your code 🔠

    import (
	    alf "github.com/PiterWeb/Alf-Router"
    )

Write this simple structure

    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