Module: Guaraci

Defined in:
lib/guaraci.rb,
lib/guaraci/server.rb,
lib/guaraci/request.rb,
lib/guaraci/version.rb,
lib/guaraci/response.rb

Overview

# Guaraci is a minimalist Ruby web framework built on Async::HTTP. It provides a simple, clean API for building web applications without complex DSLs or extensive configuration.

The framework embraces plain Ruby patterns and encourages the use of pattern matching for routing, making it perfect for modern Ruby applications.

Examples:

Basic application

require 'guaraci'

Guaraci::Server.run do |request|
  case [request.method, request.path_segments]
  in ['GET', []]
    Guaraci::Response.ok { |r| r.html("<h1>Welcome to Guaraci!</h1>") }.render
  in ['GET', ['api', 'health']]
    Guaraci::Response.ok { |r| r.json({status: "ok", timestamp: Time.now}) }.render
  else
    Guaraci::Response.new(404) { |r| r.json({error: "Not found"}) }.render
  end
end

Author:

  • Guilherme Silva

Version:

  • 1.0.0

Defined Under Namespace

Classes: Request, Response, Server

Constant Summary collapse

VERSION =
"1.0.0"