Deprecate API (include a CRITICAL breaking change)
This release includes a CRITICAL breaking change, please read following to migrate from previous version.
- API to action by tbrand
What has been changed?
I decided to remove API (the alias of Proc) since I can implement router.cr by simpler way.
README.md has been updated for the new interface.
Following code shows how to migrate from previous version.
Previous version
class WebServer
include Router
@route_handler = RouteHandler.new
@index = API.new do |context, params|
context.response.print "Hello"
context
end
def initialize
draw(@route_handler) do
get "/", @index
end
end
def run
server = HTTP::Server.new(3000, @route_handler)
server.listen
end
end
Current version
class WebServer
include Router
def draw_routes
get "/" do |context, params|
context.response.print "Hello"
context
end
end
def initialize
draw_routes
end
def run
server = HTTP::Server.new(3000, route_handler)
server.listen
end
end