File: config.ru

package info (click to toggle)
ruby-otr-activerecord 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 356 kB
  • sloc: ruby: 561; sh: 133; makefile: 6
file content (15 lines) | stat: -rw-r--r-- 335 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require_relative 'environment'

use OTR::ActiveRecord::ConnectionManagement
use OTR::ActiveRecord::QueryCache

map '/' do
  run ->(env) {
    body = Widget.all
      .map { |w|
        {id: w.id, name: w.name}
      }
      .to_json
    [200, {'Content-Type' => 'application/json', 'Content-Length' => body.size.to_s}, [body]]
  }
end