Sha256: 312217645023c7b3fb8954248ce65bc03afcb625a423b0d2411fdd4128e49e27

Contents?: true

Size: 579 Bytes

Versions: 12

Compression:

Stored size: 579 Bytes

Contents

#!/usr/bin/env falcon --verbose serve -c

class MyApp
	def initialize(app)
		@app = app
		
		@words = File.readlines('/usr/share/dict/words', chomp: true).each_slice(3).to_a
	end
	
	def call(env)
		body = Async::HTTP::Body::Writable.new(queue: Async::LimitedQueue.new(8))
		
		Async do |task|
			@words.each do |words|
				Async.logger.debug("Sending #{words.inspect}")
				body.write(words.join(",") + "\n")
				task.sleep(1)
			end
		ensure
			body.close($!)
		end
		
		return [200, [], body]
	end
end

# Build the middleware stack:
use MyApp

run lambda {|env| [404, {}, []]}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
falcon-0.35.2 examples/csv/config.ru
falcon-0.35.1 examples/csv/config.ru
falcon-0.35.0 examples/csv/config.ru
falcon-0.34.5 examples/csv/config.ru
falcon-0.34.4 examples/csv/config.ru
falcon-0.34.3 examples/csv/config.ru
falcon-0.34.2 examples/csv/config.ru
falcon-0.34.1 examples/csv/config.ru
falcon-0.34.0 examples/csv/config.ru
falcon-0.33.11 examples/csv/config.ru
falcon-0.33.10 examples/csv/config.ru
falcon-0.33.9 examples/csv/config.ru