Sha256: bd6c079fda1b62c3672c5fd90453ccec1652895e49ee4eb64b70172ddc3e6274

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

Angelo
======

A Sinatra-esque DSL for Reel.

__SUPER ALPHA!__

### Quick example

```ruby
require 'angelo'

class Foo < Angelo::Base

  TEST = {foo: "bar", baz: 123, bat: false}.to_json

  def pong; 'pong'; end
  def foo; params[:foo]; end

  get '/ping' do
    pong
  end

  post '/foo' do
    foo
  end

  post '/bar' do
    params.to_json
  end

  post '/emit' do
    websockets.each {|ws| ws.write TEST}
    params.to_json
  end

  socket '/ws' do |s|
    websockets << s
    while msg = s.read
      5.times { s.write TEST }
      s.write foo.to_json
    end
  end

end

Foo.run
```

### Tilt / ERB

To make `erb` available in route blocks

1. add `tilt` to your `Gemfile`:

```ruby
gem 'tilt'
```

2. require `angelo/tilt/erb`
3. include `Angelo::Tilt::ERB` in your app

```ruby
class Foo < Angelo::Base
  include Angelo::Tilt::ERB

  @@views = 'some/other/path' # defaults to './views'

  get '/' do
    erb :index
  end

end
```

### License

see LICENSE

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
angelo-0.0.4 README.md