Sha256: a6f199a68ae15d01c2528c86f2eaf4b4bd517af3433e3c6be7b70767d0185fa8
Contents?: true
Size: 469 Bytes
Versions: 2
Compression:
Stored size: 469 Bytes
Contents
require 'rack' require 'cors/config' # How to include the Cors::Config Middleware use Cors::Config class MyApp def call(env) request = Rack::Request.new(env) headers = { 'Content-Type' => 'text/html' } case request.path when '/status' [200, headers, ["100"]] when '/products' [200, headers, ["Hello, developer! Your products are: MacBook"]] else [404, headers, ["Uh oh, path not found!"]] end end end run MyApp.new
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cors-config-0.2.6 | bdd_spec/config.ru |
cors-config-0.2.5 | bdd_spec/config.ru |