route.cr v0.2.0 Release Notes

Release Date: 2017-11-03 // about 4 years ago
  • 🚑 This release includes a CRITICAL breaking change , please read following to migrate from previous version.

    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 WebServerinclude [email protected]\_handler = RouteHandler.new @index = API.new do |context, params| context.response.print "Hello" context enddef initialize draw(@route\_handler) do get "/", @indexendenddef run server = HTTP::Server.new(3000, @route\_handler) server.listen endend
    

    Current version

    class WebServerinclude Routerdef draw\_routes get "/" do |context, params| context.response.print "Hello" context endenddef initialize draw\_routes enddef run server = HTTP::Server.new(3000, route\_handler) server.listen endend