bakercp / ofxHTTP

A suite of HTTP tools, including clients and servers for openFrameworks.
MIT License
109 stars 40 forks source link

custom route handler events? #24

Closed chriship closed 8 years ago

chriship commented 9 years ago

Is it possible to set up new route handlers? For example, if I call the following url:

http://localhost:7890/test

In OF I can enable a handler for the 'test' route instead of only post?

bakercp commented 9 years ago

You should check out IPVideoRoute.h, IPVideoRouteHandler.h and IPVideoRouteSettings.h as an example. You can configure how the route response by changing its settings (which are in the BaseRouteSettings class).

In the settings you can define which method is supported (POST, PUT, GET, etc).

chriship commented 9 years ago

Thanks, but I am a bit lost with this. Is there a simple example somewhere?

bakercp commented 9 years ago

Are you trying to "POST" to the http://localhost:7890/test url?

chriship commented 9 years ago

Thats right. I suppose I can post to http://localhost:7890/post but would like to define different routes to post to if possible.

On Tue, Jan 27, 2015 at 10:26 PM, Christopher Baker < notifications@github.com> wrote:

Are you trying to "POST" to the http://localhost:7890/test url?

— Reply to this email directly or view it on GitHub https://github.com/bakercp/ofxHTTP/issues/24#issuecomment-71741393.

bakercp commented 9 years ago

In your setup of the POST example, perhaps try:

    ofx::HTTP::BasicPostServerSettings settings;

    settings.setRoutePathPattern("/test");

    // Many other settings are available.
    settings.setPort(7890);
bakercp commented 8 years ago

Marking this as closed. Please reopen if the issue persists.