aisk / vox

Simple and lightweight Go web framework inspired by koa
https://aisk.github.io/vox/
MIT License
84 stars 7 forks source link

Support apply middlewares for route #27

Open marswong opened 4 years ago

marswong commented 4 years ago

currently we could only apply global middlewares, in complicated applications, we might need to apply middlewares for different business, assume there are routes (/foo and '/bar') and middlewares (foo and bar), the usage could be:

app.Use('/foo', foo)
app.Use('/bar', bar)
aisk commented 4 years ago

I think middleware for sub router is a better choice? #14

marswong commented 4 years ago

I think middleware for sub router is a better choice? #14

yup, sub router is a good choice for simple router, but what if we need different pre-process logic for the same-level sub router?