Ruby Backend
Ride The Streetcar is framework-agnostic, meaning that you can use it with any Ruby server architecture. As long as you can return a string response, you can use Streetcar!
Integration Examples #
Sinatra #
require "ride_the_streetcar"
helpers do
def streetcar = RideTheStreetcar.dsl
end
# in your routes:
post '/path/to/url' do
streetcar.ride do
...
end
end
Roda #
require "ride_the_streetcar"
module StreetcarHelper
module InstanceMethods
def streetcar = RideTheStreetcar.dsl
end
end
Roda.plugin StreetcarHelper
# in your routes:
route do |r|
r.post '/path/to/url' do
streetcar.ride do
...
end
end
end
Hanami #
# config/providers/streetcar.rb
Hanami.app.register_provider(:streetcar) do
prepare do
require "ride_the_streetcar"
end
start do
register "streetcar", RideTheStreetcar.dsl
end
end
# in your actions:
module MyApplication
module Actions
module SomethingFun
include Deps["streetcar"]
class Riding < MyApplication::Action
def handle(request, response)
response.body = streetcar.ride do
...
end
end
end
end
end
end
Rails #
# app/controllers/application_controller
require "ride_the_streetcar"
class ApplicationController < ActionController::Base
def streetcar = RideTheStreetcar.dsl
end
# in your controllers
class SomethingFunController < ApplicationController
def riding
render(html: streetcar.ride do
...
end.html_safe)
end
end