Class: RailsEventStore::Browser::StreamsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_event_store/browser/streams_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
# File 'app/controllers/rails_event_store/browser/streams_controller.rb', line 4

def index
  streams = Rails.configuration.event_store.get_all_streams
  render json: { data: streams.map { |s| serialize_stream(s) } }, content_type: 'application/vnd.api+json'
end

#showObject



9
10
11
12
# File 'app/controllers/rails_event_store/browser/streams_controller.rb', line 9

def show
  events = Rails.configuration.event_store.read_stream_events_backward(stream_name)
  render json: { data: events.map { |e| serialize_event(e) } }, content_type: 'application/vnd.api+json'
end