core icon indicating copy to clipboard operation
core copied to clipboard

Which is the best way to use middleware ?

Open vic4key opened this issue 8 years ago • 3 comments

Hi author, Hi everybody,

Could you please tell me the best way to use the middleware (fast + professional + standardized) by this framework?

Thanks, Vic P.

vic4key avatar Dec 20 '17 06:12 vic4key

Just use the before and after methods and register your own functions as middleware. If you want a more extensive setup you can try something like https://github.com/AndrewPodner/flight-MVC.

mikecao avatar Jan 26 '18 17:01 mikecao

@mikecao Sorry to bring up an old thread but I had a similar question. I know I need to use a before filter to implement a before middleware, but I don't know which hook to pick.

Let's say I wanted to add csrf protection for post requests. Which hook would I add a before filter to, to inspect the request method, and check for a crsf token when it's POST?

carc1n0gen avatar May 03 '18 13:05 carc1n0gen

@carc1n0gen I did it time ago. Take a look at my sample/template project https://github.com/vic4key/sample.git @mikecao I designed it based on your nice framework. Any comment for it if you are free? Thanks.

vic4key avatar Sep 10 '19 20:09 vic4key

Currently being worked on with latest update #514.

krmu avatar Jan 12 '24 21:01 krmu