Comments (4)
Many of the things you'd use "plugins" for in other frameworks you can already do with Rocket. For example, you might imagine a library that exposes many "admin panel" routes. Then, your application could simply configure that library and mount those routes. That would look something like this:
fn main() {
let admin_routes = AdminLibrary::config(param, param, ..);
rocket::ignite().mount("/admin", admin_routes).launch();
}
You could even get rid of the AdminLibrary::config
step if the library is amenable to being configured via Rocket.toml
extra parameters, as discussed in the API docs. This is something you can do today, and it doesn't introduce another concept.
I don't have a high opinion of catch-all ideas like plugins and middleware. I'd rather find a solution that works very well for a few things rather than poorly for most things. Many of the things that might lead you to reach for plugins or middleware elsewhere can already be done with Rocket in a different, usually cleaner and more focused way. I'd like to keep the concepts to a minimum.
from rocket.
There are some use cases like response compression, filters that are applicable for multiple routes (auth, logging, response header alterations .. ). middlewares i think are better fit. But being a rust newbie, i cant rule out if there are language features to achieve the same thing. Any suggestions how these things are going to be addressed.
from rocket.
@SergioBenitez I'm quite interested in using JWT - would a plugin be required for it?
Edit - just APIKey example, I'm guessing that's the road to pursue.
from rocket.
@stephanbuys That's right. :)
Okay, so looks like we're really talking about middleware here. Closing in favor of #55.
from rocket.
Related Issues (20)
- Handling of null bytes in forms is problematic HOT 6
- Improvements for the web serach: Content-Type, text/plain HOT 4
- Phase out async_trait macro HOT 2
- Recognise source maps in `ContentType::from_extension` HOT 2
- route rank clarification HOT 1
- Link to GitHub discussion from the web site HOT 1
- Supply PanicInfo to Catchers where applicable HOT 2
- (Solved) Rocket database fairing panicking while connecting to dockerized postgres on MacOS Sonoma HOT 1
- how to return error as a Json from FromParam HOT 3
- Responder enums not serializing like expected HOT 1
- FileServer can serve pre-gzipped content if it exists on the filesystem HOT 1
- Cookies aren't read by get methods but it exists in the browser HOT 2
- HTTP3/QUIC support HOT 15
- Add HTMLStream HOT 5
- cookie removal and Microsoft Edge HOT 7
- Inject script to auto-reload browser when Rocket restarts
- Rocket App Hangs HOT 5
- DefaultListener::bindable() isnβt usable HOT 8
- Allow routes that match any method HOT 4
- Hyper and Rocket disagreeing on validity of URL HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocket.