Add action to get movie infos

master
Guillaume Dott 2015-11-12 12:40:16 +01:00
parent 67cc23103c
commit 42b81b5a5f
1 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,11 @@ module Librarix
slim :index, locals: {movies: Librarix::Filter.new(params).movies} slim :index, locals: {movies: Librarix::Filter.new(params).movies}
end end
get '/movie/:id' do |id|
movie = Librarix::Redis::Movie.new(id).fetch
slim :movie, layout: !request.xhr?, locals: {movie: movie}
end
get '/search' do get '/search' do
movies = if params['search'].nil? movies = if params['search'].nil?
Tmdb::Movie.popular.map { |m| Tmdb::Movie.new(m) } Tmdb::Movie.popular.map { |m| Tmdb::Movie.new(m) }