Sha256: 3ea3ca5e496cd9e6e24c86b8621e891a668c777d88496cc05a5cebf103b2e321

Contents?: true

Size: 532 Bytes

Versions: 15

Compression:

Stored size: 532 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'tipi'

opts = {
  reuse_addr:  true,
  dont_linger: true
}

puts "pid: #{Process.pid}"
puts 'Listening on port 4411...'

app = Tipi.route do |r|

  r.on_root do
    r.redirect '/hello'
  end
  r.on 'hello' do
    r.on_get 'world' do
      r.respond 'Hello world'
    end
    r.on_get do
      r.respond 'Hello'
    end
    r.on_post do
      puts 'Someone said Hello'
      r.redirect '/'
    end
  end
end

spin do
  Tipi.serve('0.0.0.0', 4411, opts, &app)
end.await

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
tipi-0.55 examples/routing_server.rb
tipi-0.54 examples/routing_server.rb
tipi-0.53 examples/routing_server.rb
tipi-0.52 examples/routing_server.rb
tipi-0.51 examples/routing_server.rb
tipi-0.50 examples/routing_server.rb
tipi-0.49 examples/routing_server.rb
tipi-0.47 examples/routing_server.rb
tipi-0.46 examples/routing_server.rb
tipi-0.45 examples/routing_server.rb
tipi-0.43 examples/routing_server.rb
tipi-0.42 examples/routing_server.rb
tipi-0.41 examples/routing_server.rb
tipi-0.40 examples/routing_server.rb
tipi-0.39 examples/routing_server.rb