Open felixletkemann opened 7 years ago
Since accessing the sinatra routes over CoAP, the workaround is the following:
post '/blub/hallo' do
puts "\n\n\n\n"
puts params.inspect
puts "\n\n\n\n"
'Test Antwort'
end
get '/.well-known/core' do
content_type 'application/link-format'
'</blub/hallo>;sh="/t";n="Hallo",
</blub/zweitertest>;sh="/l";ct=41;n="HalloTest"'
end
Automatically generating .well-known/core
is currently only supported in Rails. I will keep this issue open as feature request.
Would you like to add this feature?
Maybe I can add this feature as soon as I get a little deeper into coap and into the internal logic of the david gem. At the moment, I would prefer just adding a few lines of code to the documentation that describe how to use david with sinatra.
I'm looking at this now from a different point of view: making sure that rspec requests can get from /.well-known/core. I already changed how to link list was created in my pull request. I've submitted issue #10 about this.
While the readme of David lists sinatra as one of the frameworks which are compatible with david, I could not get david to work with sinatra so far. Adding the david gem (together with cbor) will make rackup talk over coap just as desired. Unfortunately, there is no .well-known/core route to tell the CoAP client what is available. Also, I can not use the discoverable option in my controller, since the "discoverable" option is depending on the railties. In order to be compatible with all the other frameworks, there should be a way to make the .well-known/core route available. Do you have any working example with sinatra and david?