Ogeon / rustful

[OUTDATED] A light HTTP framework for Rust
https://docs.rs/rustful
Apache License 2.0
862 stars 52 forks source link

Rewrite and/or replace some examples #85

Closed Ogeon closed 7 years ago

Ogeon commented 8 years ago

Most of the examples are relics from the early days and has been retrofitted with new or changed features. It would be nice to have some nice solid examples that really showcases the library, and I would like to ask for some help when it comes to this. It's easy to be blind for what someone new to the library want to see in an example if you already know the ins and outs of it, so it would be great to get some input or help from people with a different perspective

I don't think we have to touch todo.rs, except maybe for some better comments or structure, since it's pretty recent. Same goes for tiny_hello.rs, but all the other examples are free to do anything with. That includes the documentation examples. Keep in mind, though, that hello_world.rs is the most important one, since it's also shown in README.md. It should be short, summarize the essentials of Rustful as good as possible, and not give any false hopes. People should see it, think "this looks nice", and not feel disappointed* if they decide to try using the library for real.

Any sort of contribution, from a comment on this issue to a full pull request, is very much welcome. Here is a task/wish list, which will be populated as things pops up:

It's all up for grabs.


*Small examples are tricky, and Rustful is far from perfect, so there will be exceptions. I have no illusions when it comes to this, but It's not a reason to not try.

allan-simon commented 8 years ago

What i found to be missing is how to use context /global to attach a database connection (like rust-postgres) as it's a very common use case to mix a web service with a db :)

Ogeon commented 8 years ago

The todo example has an emulated database, but it may be better to have a more focused example. It's such a common thing, as you said. I'll add it to the list. Thanks :+1:

allan-simon commented 8 years ago

it's me who should thank you for the framework, for the examples yes, I think a lot of people are like me, right now I would love to use rust in a professional context but I have very few time to dedicate to it, so the more I can be guided in brainless examples the more I only need to focus on "how to translate that into actual business requirements" rather that "how to translate that into 'real database' and then how to translate into business requirements". It also help "deciders/ other team members" to be less scared if they see "I don't understand rust syntax, but ok here is my db connection, here is my sql requests, here is my response turned into a json" (which i think should the things to have demonstrated on the main example in the readme)

Ogeon commented 8 years ago

The tricky part, when writing examples, is making them simple enough to be understood at a glance, while still demonstrating a "real world" situation. The example in the readme is especially important, since it's often the first impression someone gets, so it can't be too complicated, but it has to communicate what's interesting with the framework. It should basically say "Hey, this is the essence of Rustful, and I hope it looks interesting".

The current example doesn't really tick all the boxes, IMO, which is one of the reasons for opening this issue. Replacing it with a database example would tick the "real world" example box, but the database stuff may take focus from the framework. This isn't a database library, after all. :smile: This will need some more research, though, so I'm not making a decision either for or against doing this. There may be a sufficiently simple database solution out there, and it would be great if it could be used in the main example.

Ogeon commented 7 years ago

Closing because of inactivity from my part. I'll try to make a more targeted effort sometime in the future.