Skip to content

aqandeh/rakhsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rakhsh

Rakhsh Web Framework

Rakhsh is a minimal and lightweight web framework for Go designed to make building HTTP services simple and fast while staying close to Go's standard library.

The goal of Rakhsh is to provide a clean developer experience without hiding how Go's net/http works.

Features

  • Simple and clean API
  • Built on top of Go's net/http
  • Lightweight and minimal
  • Easy to understand and extend

Installation

First initialize your Go module if you haven't already:

go mod init your-project

Then install Rakhsh:

go get github.com/aqandeh/rakhsh

Quick Start

Create a main.go file:

package main

import "github.com/aqandeh/rakhsh"

func main() {
app := rakhsh.New()

app.GET("/", func(c *rakhsh.Context) {
	c.String(200, "Hello from Rakhsh 🚀")
})

app.Listen(":8080")
}

Run your server:

go run .

Open your browser:

text http://localhost:8080

Routing

Rakhsh provides simple HTTP method routing.

GET Route

app.GET("/users", func(c *rakhsh.Context) {
c.String(200, "Users list")
})

POST Route

app.POST("/users", func(c *rakhsh.Context) {
c.String(200, "User created")
})

Context

Each handler receives a Context object.

func(c *rakhsh.Context)

The context provides access to:

- `http.ResponseWriter`
- `*http.Request`
- route parameters

Sending Responses

JSON Response

app.GET("/api", func(c *rakhsh.Context) {
c.JSON(200, map[string]string{
	"framework": "Rakhsh",
	"status": "running",
})
})

Plain Text Response

app.GET("/hello", func(c *rakhsh.Context) {
c.String(200, "Hello world")
})

Starting the Server

Start the HTTP server with:

app.Listen(":8080")

This will start the server on port 8080.

Example Project Structure

project/
│
├── go.mod
├── main.go
│
└── rakhsh/
├── app.go
├── router.go
└── context.go

Philosophy

Rakhsh follows a few simple ideas:

  • Keep the API minimal
  • Stay close to Go's net/http
  • Avoid unnecessary abstractions
  • Make the framework easy to understand and extend

Roadmap

Planned features for future versions:

  • Dynamic routes (/users/:id)
  • Middleware support
  • Route groups
  • Request binding
  • Validation
  • Logging middleware
  • Static file serving
  • CLI project generator

License

MIT License

About

a minimal fast web framework with golang

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages