Skip to content

KodaFramework/koda-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koda UI

This lib helps you access koda data from your front end sinatra app Instead of using the rest api it goes directly to mongo (and will support caching)

Usage

Simply include the helpers in your sinatra app

class MyApp < Sinatra::Base
  include Koda::UI::Helpers
end

Then in your routes you can access data from the model:

  get '/cars/?' do
    @cars = koda.query('/cars')

    erb :cars
  end

Which will return an array of hashes with document summary info. If you were to get this using the rest api it would be equivalent to calling /cars.

You can also get a particular document

  get '/cars/:alias/?' do |car_alias|
    @car = koda.single("/cars/#{car_alias}")

    erb :car
  end

Which will return a single hash containing the document. Again if you were using the rest api it would be equivalent to calling /cars/:alias.json.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages