Routing
Simpler Route
#src/routes/web.cr
get "/" do
"Hello World!"
end
All Routes are declared on the file src/routes/web.cr
when you visit http://localhost/
you will see the page return "Hello World!"
This endpoint retrieves all kittens.
REST Calls
#src/routes/web.cr
get "/" do
.. show something ..
end
post "/" do
.. create something ..
end
put "/" do
.. replace something ..
end
patch "/" do
.. modify something ..
end
delete "/" do
.. annihilate something ..
end
You can handle HTTP methods as easy as writing method names and the route with a code block. Kemal will handle all the hard work.