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)
- Possible Incompleteness HOT 1
- Possible Incompleteness HOT 1
- doc: change `&ContentType` with `&Accept` in the list of implementations of `FromRequest` HOT 1
- [Feature]: Enhanced State Mutation for Effortless Handling of Shared Resources HOT 5
- Guide navigation causes relative links inside articles to 404 HOT 1
- Redirection to a route which takes a vector parameter results in an error HOT 1
- Allow users to create of Data<'r> objects HOT 5
- Validation not invoked on Json HOT 6
- Implement `FromForm` for `Range` HOT 1
- Missing license files in rocket_codegen-0.5.0.crate HOT 2
- Add SQLite extensions HOT 2
- Middleware that handles requests for static resources HOT 2
- Unable to build: no `Serialize` in `de` HOT 3
- Add default content_type for TempFile uploads HOT 2
- Could not find `json` in `serde` HOT 1
- Can't change IP that Rocket starts from. HOT 1
- Clippy lint: temporary with significant `Drop` can be early dropped HOT 1
- Rocket sometimes resets connection instead of responding with 413 error response HOT 2
- MiniJinja can't be used for templates HOT 1
- Routing by hostname HOT 10
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.