Here is an example of how to create an HTTP server with an OPTIONS route using Rust's Hyper crate:
main.rs1067 chars34 lines
In this example, we define a single route at the path "/options" that responds to OPTIONS requests with an empty body and the "ALLOW" header set to "OPTIONS, GET, POST".
Any other request will result in a 404 response.
The server is bound to localhost on port 3000 and runs indefinitely until manually terminated.
gistlibby LogSnag