Skip to content

Releases: tbrand/router.cr

Crystal version 1.0

11 Apr 15:02
42b4bf0
Compare
Choose a tag to compare

Formatted codes

18 Mar 05:50
Compare
Choose a tag to compare
v0.2.2

fmt

add leading / to Radix::Tree

16 Jan 15:09
d8a2a2d
Compare
Choose a tag to compare

This release following issues

  • add leading / to Radix::Tree (Thanks @stakach 🎉) #21

Deprecate API (include a CRITICAL breaking change)

03 Nov 14:30
Compare
Choose a tag to compare

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 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

Deprecate profiler and renderer

03 Sep 07:23
Compare
Choose a tag to compare

Return 404 if route not found

19 Jul 14:37
Compare
Choose a tag to compare

This release includes following topics

route.cr to router.cr

03 May 15:48
Compare
Choose a tag to compare

Breaking change

Rename this repository from route.cr to router.cr. Please check README.md. 🚀

Speedup path lookup by avoiding object allocation

13 Apr 13:05
Compare
Choose a tag to compare

This release includes following features

  • Use String.build to format_data in profile #10 (@veelenga) 🎉
  • Speedup path lookup by avoiding object allocation #9 (@luislavena) 🎉
  • Stop raising exception when the route not found #8

Merge context.request.query_params in to route.params

07 Apr 13:30
Compare
Choose a tag to compare

Updates

  • Merge context.request.query_params in to route.params (@RomanHargrave)
  • Extract path from resource string before searching routes (@RomanHargrave)
  • Perf: Upcase http method during compile time (@splattael)

Thanks for the contributes:rocket:

Every PR or comments are welcome!

Add ProfileHandler

02 Apr 11:33
Compare
Choose a tag to compare

Now you can easily get a profile by accessing "/profile"

[ GET /one ]        Access: 10          Total: 704.0µs      Ave: 70.4µs
[ GET /two ]        Access: 9           Total: 309.0µs      Ave: 34.3µs
[ GET /three ]      Access: 9           Total: 262.0µs      Ave: 29.1µs

See sample to see how to use ProfileHandler.