Update: According to this issue async does not work with Diesel, so, the method to_async from web::get might not work as expected, it will work but...
For further actions, you may consider blocking this person and/or reporting abuse
This is a really awesome write-up, thank you!
Have you attempted to port an application from
actix_web
0.7 to 1.0 yet? If so, how did it go? There are some significant API changes so I haven't tried yet.Hi, thanks.
In the meantime I'm learning about the migration from 0.7 to 1.0 and I'm trying to document everything I can. Something I've realized it's that is easier to create handlers and assigning it to a Server.
you don't have models.rs? in ur project so it confuse for newcomer :) prnt.sc/p0bfqb
Oops!, thanks for pointing this out, fixed now.
thanks also like to know so you know about the swift back end? I am a little bit confuse is Rust is ready for the production type of API app for a mobile app? i have my own API written in swift that's working good but i am also interested in RUST so i start to reading you post :)
I think as an API backend Rust is ready for production, might need to polish some areas but you could have your app deployed with confident. for example: figma.com/blog/rust-in-production-...
do you know swift back end like vapor ? if yes what you think about swift back end?
thanks
To be honest, I don't know swift, so I can't make an informed opinion about it.
ok no worry thanks for reply also check this prnt.sc/p0et3l image you don't have still extern crate futures; and you add it so its give us error too
also, i follow your tutorial till here
Finally goes to http://localhost:8088/products.
but and trying to understand why it not showing :( my products list already debugging more then 2 hours :(
here is my code please check me if you will have
bitbucket.org/Alifdev/ruststore
Hi, sorry for the late response, I was on vacations. Try to follow these tips and tell me if it works.
curl http://127.0.0.1:8088/products -H "Content-Type: application/json" -d '{"name": "socks", "stock": 7, "price": 2}
curl http://localhost:8088/products
Tell me if it works.
yes it is working thanks :)
Hi, your tutorial is awesome!
But I find a little issue of
diesel
that the lineuse crate::schema::products::dsl::*;
in
ProductList
implementation cannot be placed in the top which will cause anunmatched type
error ofid
infind
method ofProduct
implementation.This issue caused by a duplicated
id
fromcrate::schema::products::dsl
.Hi, did you take a look at the last version, sometimes I fix these issues but I forgot to mention them, github.com/practical-rust-web-deve...
Thanks for your reply. Your source code can works well.
It is my bad to take the line above to the top of the module. 😄
Thats a neat tutorial! Would like to see how we can use tokio in conjunction with actix. For eg. making multiple async calls(futures) to db, wait for all the futures, aggregate the resultset and respond to the request. I couldn't find any examples like that anywhere
I am still going through these and am new to Rust. But being used to frameworks like flask in python, is it easy or possible to abstract out the model methods to not have the boilerplate for the db connection?
some frameworks make it so you can do
request.db
or maybe move it to a parent model or something? that way the model methods are a lot cleaner?Well, I think it's possible, passing the db connection through a Trait, and then implements the trait for every model. Seems like a fun thing to do, maybe in a future post I'll try to implement it.
that would be great.
Big thanks bro....
I'm new at rust and after i read this article my mind has blow.... hha
No problem, I'm glad I could help.