Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'sinatra'
get '/' do
erb :index
end
post '/' do
post_title = params[:post_title]
file_name = post_title.gsub! '\s+', '_'
File.open(file_name, 'w') do |f|
f.write params[:post_title]
f.write "\n---\n\n"
f.write params[:post_text]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment