File: custom_middleware.rb

package info (click to toggle)
ruby-innate 2013.02.21-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 848 kB
  • ctags: 622
  • sloc: ruby: 4,340; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 695 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'rubygems'
require File.expand_path('../../lib/innate', __FILE__)

class Demo
  Innate.node '/'

  def index
    'Hello, World!'
  end

  def empty
    response.status = 405
    ''
  end
end

Innate.options.mode = :dev

Innate.middleware(:dev) do
  # Makes sure all requests and responses conform to Rack protocol
  use Rack::Lint

  # Avoid showing empty failure pages, give information when it happens.
  use Rack::ShowStatus

  # Catch exceptions inside Innate and give nice status info
  use Rack::ShowExceptions

  # Log access
  use Rack::CommonLogger

  # Reload modified files before request
  use Rack::Reloader

  # Start up the application
  run Innate.core
end

Innate.start