1

I want to get user input in an html form and use the data to populate a database table. Sinatra returns the form data in a hash, params. Can I do this with Kemal and Crystal?

Please note, I am in the process of learning Crystal, so this may not even be possible yet.

Thanks in advance for all answers. Meanwhile, I'm still digging:)

lewis
  • 131
  • 1
  • 9
  • I found this while looking through the Crystal docs. I can use env.params.body and assign to a variable name and use name["key'] to access the form data. Still looking. – lewis Nov 20 '17 at 23:29

1 Answers1

2

In Crystal, an HTTP::Handler receives an HTTP::Server::Context argument. Through this context, you can access the request and read the form data. The same also applies to Kemal, there is also a section in the guid: HTTP Parameters

Johannes Müller
  • 5,581
  • 1
  • 11
  • 25