A lightweight HTTP server framework built from scratch in Go using raw TCP connections. No external dependencies, just pure Go standard library.
- 🚀 Built from scratch using TCP sockets
- 🛣️ Fast HTTP routing with support for path parameters
- 📦 Simple and intuitive API
- 🔄 JSON response helper
- ⚡ Concurrent request handling with goroutines
- 🎯 Pattern matching for dynamic routes
go get github.com/codewithdpk/naradHere's a simple example to get you started:
package main
import (
"github.com/codewithdpk/narad/internal/server"
)
func main() {
// Create a new router
r := server.New()
// Define a simple route
r.Handle("GET", "/", func(ctx *server.Context) {
ctx.JSON(200, []byte(`{"message": "Hello, World!"}`))
})
// Start the server on port 8080
r.Serve(":8080")
}Run the example:
go run examples/basic_server.goTest it with curl:
curl http://localhost:8080/r := server.New()
// GET request
r.Handle("GET", "/api/users", func(ctx *server.Context) {
ctx.JSON(200, []byte(`{"users": []}`))
})