zendesk/app_scaffold

Sinatra doesn’t know this ditty.

ralfr opened this issue · 4 comments

ralfr commented

Installed everything as per the README locally on my Mac. nf start. No errors.

When pointing my browser to http://localhost:4567 I get

Sinatra doesn’t know this ditty.

Try this:
# in Library/Ruby/Gems/2.0.0/gems/zendesk_apps_tools-1.34.1/lib/zendesk_apps_tools/server.rb
class ZendeskAppsTools::Server
  get '/' do
    "Hello World"
  end
end

Console:

6:10:41 PM server.1 |  localhost - - [18/Aug/2016:18:10:41 CEST] "GET / HTTP/1.1" 404 636
6:10:41 PM server.1 |  - -> /

What am I doing wrong?

@ralfr you don't access the local scripts directly (at least not at the root). What you do is go to your zendesk page and add ?zat=true to the end of the URL as described in the v1 docs here: https://support.zendesk.com/hc/en-us/articles/221688927

(to get Google Chrome to allow the mixed content to load, click on the shield icon that appears in the URL bar).

ovvn commented

Getting the same error, does anyone know how to fix this?

ovvn commented

Solved it by adding this to the server.rb

    get '/' do
      "Hello World"
    end

So now it looks as follows:

module ZendeskAppsTools
  class Server < Sinatra::Base
    set :server, :thin
    set :logging, true
    set :protection, except: :frame_options
    ZENDESK_DOMAINS_REGEX = %r{^http(?:s)?://[a-z0-9-]+\.(?:zendesk|zopim|zd-(?:dev|master|staging))\.com$}

    get '/' do
      "Hello World"
    end

    get '/app.js' do
      serve_installed_js
    end

...

@JohnRomanski is correct. Having said that, you can access individual assets within the assets folder if you wish, e.g. http://localhost:4567/iframe.html.