ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.46k stars 889 forks source link

what is middleware's usage? #336

Open xingwudao opened 5 years ago

xingwudao commented 5 years ago

Is there anyone show me some scenes in which the middleware should be used?

moneroexamples commented 5 years ago

Offical example is here: https://github.com/ipkn/crow/blob/master/examples/example.cpp

With middleware you can enable, e.g., Basic http authentication for all your content. I was playing with it some time ago. You can check the code here: https://github.com/moneroexamples/onion-monero-blockchain-explorer/blob/basicauth/main.cpp#L291

I don't have any working instance of it life, but the code should be enough to give you some basis for it.