watts
watts copied to clipboard
Resource-oriented, Rack-based, minimalist web framework.
``` require 'watts' class Simple < Watts::App class EZResource < Watts::Resource get { response.headers['Content-Type'] ="text/html;charset=utf-8" #"Hello, World!\n" ERB.new(File.read("view/test.erb")).result } end resource('/', EZResource) end ``` curl http://localhost:9292/ HTTP/1.1 200 OK Content-Type:...
add custom response.header ['Content-Type'] like 'application/json' ```RUBY post { response.header['Content-Type']= 'application/json' request.params.to_hash.to_json } ```
``` class View < Hoshi::View :html4 def hello doc { head { title "Hello, #{title}!" } body { h1 "#{username}:Here is your greeting:" p "Hello, World!" } } render end...