pete / watts Goto Github PK
View Code? Open in Web Editor NEWResource-oriented, Rack-based, minimalist web framework.
Resource-oriented, Rack-based, minimalist web framework.
Cool project Pete!
Tested with ruby 1.8.7-p72
cd watts
cp doc/examples/hello_world.rb .
gem install metaid rack mongrel
cd lib
ruby hello_world.rb
pointing my browser to http://127.0.0.1:8080/ and I see:
Read error: #<NoMethodError: private method `split' called for 14:Fixnum>
gems:
metaid-1.0
rack-1.2.1
mongrel-1.1.5
I was trying to run Watts with WEBrick instead of Mongrel, but for some reason I couldn't get any routes to work except for '/'.
I tested it out with the matching.rb
example and it had the same issue. Worked fine with Mongrel, didn't work with WEBrick. The only change was Rack::Handler::Mongrel.run
=> Rack::Handler::WEBrick.run
Of course, maybe that's the wrong way to do that, I don't know.
class View < Hoshi::View :html4
def hello
doc {
head { title "Hello, #{title}!" }
body {
h1 "#{username}:Here is your greeting:"
p "Hello, World!"
}
}
render
end
end
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: text/plain
Content-Length: 14
app.rb
require 'watts'
class Simple < Watts::App
class EZResource < Watts::Resource # Resource
get { "Hello <hr/ > " }
end
resource( ['foo',/^[0-9+]$/ ], EZResource)
end
visit http://localhost:9292/foo/33 got 404
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.