@sdogruyol sdogruyol released this Aug 14, 2018 · 25 commits to master since this release

Assets 2
  • Crystal 0.26.0 support

  • [breaking change] Removed env.params.files. You can use Crystal's built-in HTTP::FormData.parse instead

post "/upload" do |env|
  HTTP::FormData.parse(env.request) do |upload|
    filename = file.filename

    if !filename.is_a?(String)
      "No filename included in upload"
    else
      file_path = ::File.join [Kemal.config.public_folder, "uploads/", filename]
      File.open(file_path, "w") do |f|
      IO.copy(file.tmpfile, f)
    end
    "Upload OK"
  end
end
  • [breaking change] From now on to access dynamic url params in a WebSocket route you have to use:
ws "/:id" do |socket, context|
  id = context.ws_route_lookup.params["id"]
end
  • [breaking change] Removed _method magic param.

  • Added new exception page #466. Thanks @mamantoha 🙏

  • Support custom port binding. Thanks @straight-shoota 🙏

Kemal.run do |config|
  server = config.server.not_nil!
  server.bind_tcp "127.0.0.1", 3000, reuse_port: true
  server.bind_tcp "0.0.0.0", 3001, reuse_port: true
end