Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.13k stars 93 forks source link

How to respond to OPTIONS request? #170

Open ParkSeungwon opened 1 year ago

ParkSeungwon commented 1 year ago

I could find how to respond to GET or POST request.(http_post or http_get function) But how can I define respose to OPTIONS request?

eao197 commented 1 year ago

Hi, if you use express-router then it's necessary to use router's add_handler method:

router->add_handler(
    restinio::http_method_options(),
    "/options/demo",
    my_handler );

More information can be found here