mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Change single quotes to double quotes
This commit is contained in:
parent
d0ea2f049c
commit
5bc81e7e5b
1 changed files with 9 additions and 9 deletions
18
README.md
18
README.md
|
@ -42,23 +42,23 @@ dependencies:
|
||||||
In Kemal, a route is an HTTP method paired with a URL-matching pattern. Each route is associated with a block:
|
In Kemal, a route is an HTTP method paired with a URL-matching pattern. Each route is associated with a block:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
get '/' do
|
get "/" do
|
||||||
.. show something ..
|
.. show something ..
|
||||||
end
|
end
|
||||||
|
|
||||||
post '/' do
|
post "/" do
|
||||||
.. create something ..
|
.. create something ..
|
||||||
end
|
end
|
||||||
|
|
||||||
put '/' do
|
put "/" do
|
||||||
.. replace something ..
|
.. replace something ..
|
||||||
end
|
end
|
||||||
|
|
||||||
patch '/' do
|
patch "/" do
|
||||||
.. modify something ..
|
.. modify something ..
|
||||||
end
|
end
|
||||||
|
|
||||||
delete '/' do
|
delete "/" do
|
||||||
.. annihilate something ..
|
.. annihilate something ..
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
@ -69,13 +69,13 @@ Accessing the request context (query params, body, headers e.g) is super easy. Y
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# Matches /hello/kemal
|
# Matches /hello/kemal
|
||||||
get '/hello/:name' do |ctx|
|
get "/hello/:name" do |ctx|
|
||||||
name = ctx.params["name"]
|
name = ctx.params["name"]
|
||||||
"Hello back to #{name}"
|
"Hello back to #{name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Matches /resize?width=200&height=200
|
# Matches /resize?width=200&height=200
|
||||||
get '/resize' do |ctx|
|
get "/resize" do |ctx|
|
||||||
width = ctx.params["width"]
|
width = ctx.params["width"]
|
||||||
height = ctx.params["height"]
|
height = ctx.params["height"]
|
||||||
end
|
end
|
||||||
|
@ -86,8 +86,8 @@ Kemal uses *text/html* as the default content type. You can change it via the co
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# Set the content as application/json and return JSON
|
# Set the content as application/json and return JSON
|
||||||
get '/user.json' do |ctx|
|
get "/user.json" do |ctx|
|
||||||
kemal = {name: 'Kemal', language: 'Crystal'}
|
kemal = {name: "Kemal", language: "Crystal"}
|
||||||
ctx.set_content_type "application/json"
|
ctx.set_content_type "application/json"
|
||||||
kemal.to_json
|
kemal.to_json
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue