Skip to content

Document adding a RESTful API #151

Description

@dblock

Coming from #150 (comment), document how to add a RESTful API.

This monkey-patching should work:

module SlackRubyBotServer
  module Api
    module Endpoints
      class MyEndpoint < Grape::API
         get 'foobar' do
             { ok: true }
         end
      end

      class RootEndpoint < Grape::API
        mount MyEndpoint
      end
    end
  end
end

We should document, and possibly implement a cleaner way to do this.

It's a bit of a rabbit hole. The root endpoint is https://github.com/slack-ruby/slack-ruby-bot-server/blob/master/lib/slack-ruby-bot-server/api/endpoints/root_endpoint.rb, invoked from

Endpoints::RootEndpoint.call(env)
. It's extended in https://github.com/slack-ruby/slack-ruby-bot-server-events/blob/fb68e18314a58f7d345f98e015243307b24c8f88/lib/slack-ruby-bot-server/api/endpoints.rb#L24 for events. The instance of that middleware ( ) is started in

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions