18 lines
342 B
Ruby
18 lines
342 B
Ruby
require 'json'
|
|
require 'faraday'
|
|
require 'sinatra'
|
|
|
|
require_relative 'get_images_by_category.rb'
|
|
require_relative 'get_random_image.rb'
|
|
|
|
categories = File.readlines("categories.txt")
|
|
|
|
get '/' do
|
|
image = get_random_image(get_images_by_category(categories))
|
|
|
|
erb :index, locals: { image: image }
|
|
end
|
|
|
|
get '/about' do
|
|
erb :about
|
|
end |