node-slack-events-api icon indicating copy to clipboard operation
node-slack-events-api copied to clipboard

createServer()'s path option is unused, deprecate?

Open aoberoi opened this issue 7 years ago • 2 comments

Description

It seems that we've introduced an issue where the path argument to SlackEventAdapter#createServer() is unused (besides the log messages). This was likely the result of the refactor which made Express no longer required (#59).

It doesn't seem to have created any issues since the behavior is that all incoming requests are valid, regardless of which URL they are sent to. The only point of using path would be to block incoming requests that had a URL that didn't match, and possibly throw some kind of error (or pass it forward in the case of Express middleware - but we don't do this for any existing error).

Given that nobody seems to have complained, and this issue has existed for over 7 months, I don't think there's any demand for new path matching and error handling functionality like this.

Instead, I propose that we deprecate the path argument, and while we're at it, deprecate the expressMiddleware() method. For the latter, it doesn't add any value since it does the exact same thing as requestListener(), but just returns a function with a different arity. Express would be fine with a handler that has no next (an arity of 2), and the only thing we'd lose is the opportunity to forward errors through the middleware chain, something we're not doing at all today.

Deprecation would simply look like logging warnings when those options are used.

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

aoberoi avatar Mar 24 '19 00:03 aoberoi

If we decide to deprecate these features, we should also remove them from the documentation.

aoberoi avatar Mar 24 '19 00:03 aoberoi

https://github.com/slackapi/node-slack-sdk/issues/814

shaydewael avatar Jul 16 '19 19:07 shaydewael