by qaq · 7y ago · 0 comments
require 'grape'
params do
requires :age, type: Integer
requires :name, type: String
end
get "/hello/:name/:age" do
"Hello, #{params[:age]} year old named #{params[:name]}!"
end
In any case, my beef is more with the macro than with the function annotation, which is rather spiffy. The macro hides the fact that string manipulation in Rust definitely requires a little bit of manual reading. And I feel that as soon as your app becomes more complex Rust will just start getting more in the way. And to an experienced Rust dev that might not be a big deal, because an experienced dev knows how to work with strings or which memory management strategy so it won't bog them down. But if you're just working on something and you quickly want to whip out a service that tells people what age they are, I'd definitely go for a quick Ruby or Go service.