Open farazfazli opened 1 year ago
@LouisGariepy What are your thoughts on this?
Hi @farazfazli, thanks for reaching out.
I would definitely be open to add more examples. There are some points I'd like to discuss before moving forward though.
First, I'd like to know what's the scope of the example you're thinking of. The most minimalist setup? A "todo" or "hacker news" example to show what's possible with Cornucopia?
Second, is there something that Cornucopia does that makes it's usage with webservers particularly difficult/obscure, or is the goal simply to provide a starting template? If it's the latter, then perhaps we should consider providing template repositories instead of examples. That way, users can leverage tools like cargo-generate
(or simply download the repo, etc.), to get going quickly.
Finally, there are many popular webserver projects for Rust: axum
, actix-web
, warp
, rocket
, etc. I wouldn't want to give our users the impression that Cornucopia is somehow tied to a particular webserver. But at the same time, maintaining up-to-date implementations for many webservers might prove a maintenance burden.
I'd like to hear your thoughts on this :smile:
Hi @LouisGariepy,
Thanks for the detailed response! A todo list REST API example is a good idea. This can show how to have a configuration file for the database and also have a Dockerfile for quickly running a Postgres instance.
Really the idea is having a more complete API example which can easily be run on a developers machine. Yes it doesn't necessarily have to be actix-web as of course cornucopia is not tied to any particular webserver. I chose actix-web because it's the most popular one, and the API is stable.
Let me know your thoughts on this.
@LouisGariepy If you'd like, I can get started on this.
@farazfazli
I'm still debating if it's a good idea to include this example directly in the repo.
One reason is that to ensure that our examples are correct, we currently build and run the examples as part of the test suite. It's unclear to me how we could run a mock web server without bloating the example.
I'm also not sure about using a dockerfile with the "live" workflow, instead of the "managed" workflow used in other examples. My reasons are:
container
module (which is crate-private).Basically I'd like to keep the examples in this repo well tested, directly related to Cornucopia, and as minimal as possible.
I see two paths forward with this issue:
If we go with option 2, it could be a community project that we could shout-out in the README and the docs, or it could be included directly in the org. If we do include it in the org, we'd need to find someone dedicated to maintaining these examples.
Hi Louis,
I've been using your project and would like to add an example to the repo of using actix-web with Cornucopia. I feel this example would provide a starting point for users who want to use this project with a web server.
Looking forward to hearing your thoughts on this idea. Thanks.