Router.cr Versions Save

Minimum High Performance Middleware for Crystal Web Server.

v0.2.2

6 years ago

v0.2.1

6 years ago

This release following issues

v0.2.0

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

v0.1.12

6 years ago

This release includes following topics

v0.1.11

6 years ago

Breaking change

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

v0.1.10

7 years ago

This release includes following features

v0.1.9

7 years ago

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!

v0.1.8

7 years ago

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.