ruby sinatra json 困ったらこれをみろ。のリンク集
初歩:
中:
rightgo09-ruby.hatenadiary.org
リファレンス:
get '/memos' do
File.open('storage/*', "r") do |file|
@hash = JSON.parse(file.read, symbolize_names: true)
end
erb :index
end
メモ
<%= @hash[:title] %><%= @hash[:content] %>/*_________________*/
get '/memos' do
json = Dir.glob('storage/*').sort_by { |file| File.birthtime(file) }
@memos = json.map { |file| JSON.parse(File.read(file)) }
erb :index
end
メモ
<%= @hash['title'] %><%= @hash['content'] %>HTMLの記述