Rage is a fast web framework designed for API development, offering compatibility with Rails and advanced features like WebSocket support, background tasks, and automatic OpenAPI documentation generation.
Rage is a robust, high-performance web framework designed to be fully compatible with Rails. It enhances the development experience by incorporating essential features such as WebSocket support and automatic OpenAPI documentation generation.
Customized for flexibility, Rage can function in either Rails Mode, integrating into existing Rails applications, or Standalone Mode, allowing developers to create high-performance services effortlessly. Key documentation includes:
Here is a sample controller showcasing how to utilize Rage effectively:
require "net/http"
class PagesController < RageController::API
rescue_from SocketError do |_|
render json: { message: "error" }, status: 500
end
before_action :set_metadata
def show
page = Net::HTTP.get(URI("https://httpbin.org/json"))
render json: { page: page, metadata: @metadata }
end
private
def set_metadata
@metadata = { format: "json", time: Time.now.to_i }
end
end
Rage effectively utilizes fibers to handle requests concurrently, greatly enhancing the application's responsiveness. An advanced feature allows multiple asynchronous HTTP calls using Fiber.await, further optimizing performance.
Rage has demonstrated impressive benchmarks, highlighting its capacity to handle significant traffic and perform efficiently under load:
class BenchmarksController < ApplicationController
def index
render json: { hello: "world" }
end
end
Overall, Rage is positioned as a powerful alternative to traditional frameworks, with a strong emphasis on modern development practices and high-performance architecture.
No comments yet.
Sign in to be the first to comment.