Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

.well-known/core not available using sinatra #6

Open
felixletkemann opened this issue Jul 24, 2017 · 5 comments
Open

.well-known/core not available using sinatra #6

felixletkemann opened this issue Jul 24, 2017 · 5 comments

Comments

@felixletkemann
Copy link

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?

@felixletkemann
Copy link
Author

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

@nning
Copy link
Owner

nning commented Jul 27, 2017

Automatically generating .well-known/core is currently only supported in Rails. I will keep this issue open as feature request.

@nning
Copy link
Owner

nning commented Jul 27, 2017

Would you like to add this feature?

@felixletkemann
Copy link
Author

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.
bildschirmfoto 2017-07-28 um 11 31 57
bildschirmfoto 2017-07-28 um 11 32 52

@mcr
Copy link
Collaborator

mcr commented Feb 7, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants