-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build a larger example app #20
Comments
Some things to demonstrate:
Some typical example apps people like to see:
|
https://realworld.io/ is a nice "standard" example app that might be nice to try implement. It looks like the backend is API only, so doesn't demonstrate real templating though. Maybe could be in addition to a more "self contained" example app. I'd be interested in having a go. |
@colinbankier That sounds fantastic -- please do! Feel free to reach out on this issue or the #wg-net-web channel on Discord for questions/discussion as well. |
Well there is already a Rust implementation with Hyper+Diesel |
@DeltaManiac - yep, I saw a couple of rust attempts - one with Rocket too. I'm using them as hints to get a first step up and running :). |
I've made a super rough start https://github.com/colinbankier/realworld-tide |
@colinbankier It seems that this example is using synchronous database requests. I think this will need to be changed (either to an async database client, or to use a thread pool). Otherwise it completely defeats the point of using futures and tokio for async request handling. Sorry my comment can't be more constructive, but this is exactly the thing I've struggled to implement in Rust web apps, so I'm afraid I can't suggest a concrete path forwards. |
Thanks @nicoburns - never fear, handling this better is in the plan :) It's part of the "it ain't pretty yet" qualification. I don't expect it to be a particularly useful example yet...but wanted to share the starting point as a placeholder. My current plan is to use a thread pool, as I don't believe diesel supports actual async clients yet. If this is not true, please let me know. |
Although going very slowly due to other commitments etc, the "realworld" api example (https://github.com/colinbankier/realworld-tide) is slowly moving forward. Although very incomplete and rough around the edges, it's hopefully at a point where it has some interesting things and where others could help improve / extend it further if they so wished.
Happy to get any suggestions, issues, PRs, etc. |
@colinbankier looking very cool! |
Colin,
I want to help. Will have a look at issues and see what I can help with.
Chris
… On Mar 15, 2019, at 12:00 AM, Colin Bankier ***@***.***> wrote:
Although going very slowly due to other commitments etc, the "realworld" api example (https://github.com/colinbankier/realworld-tide <https://github.com/colinbankier/realworld-tide>) is slowly moving forward. Although very incomplete and rough around the edges, it's hopefully at a point where it has some interesting things and where others could help improve / extend it further if they so wished.
Things it aims to do so far:
Async queries with diesel. Diesel doesn't directly support async, but we can still build an async application around it using tokio_threadpool::blocking. The db module provides a Repo abstraction to encapsulate this.
Parallel database tests. Tests use isolated test transactions so database tests can be run in parallel.
HTTP level integration tests for the web layer. The test_helpers module provides a TestServer to easily simulate http requests for tests.
Separate domain logic from web logic. The conduit module contains domain logic and the web module has logic for dealing with http stuff and json request/response formats.
Happy to get any suggestions, issues, PRs, etc.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#20 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAAclCrHDDRfRsQhgRsadnpPd2yQUdz_ks5vW0UggaJpZM4YUBBw>.
|
@colinbankier is there a benefit to using the diesel pool as an async function? I have it working without doing that so I just want to make sure I'm not missing anything. I know it's blocking, but I figure it's within the async endpoint fn so it doesn't matter if it's blocking for that call but I don't actually know |
separately, a couple of comments about what I've run into in my own playground:
{
"data": {
"id": 123,
"type": "user",
"attributes": { },
"relationships": { }
}
} |
@petejodo - I assume you mean using diesel "as normal" without using |
Ohh I see where my confusion was, thinking that the async endpoint was it's own thread, d'oh. Yeah that makes total sense, thanks! |
While Colin seems to be making good progress with commits as recent as last month, I'd also like to give this a go. I think two beefier examples can't hurt, and I am new to Tide so at worst case this will be a great learning exercise for me. I am coming from a Java world (since JDK 1.1.4), so when I saw a need for a beefier example I thought of the Java Pet Store. My thought is to create a Rust Cattle Ranch, different from the Pet Store but with similar demonstrated capabilities. Skeleton Github repository is up, at https://github.com/BillBarnhill/RustCattleRanch. |
@BillBarnhill You may want to check out the other example apps at https://github.com/http-rs/tide#example-applications |
Given we have several example apps now I think we can close this. |
The current set of files in
examples
are extremely simple. It'd be great to build some more realistic (but still small) apps, both for documentation and as a way to try out the framework.The text was updated successfully, but these errors were encountered: