Can we create a full fledged CRUD application(login form) in Rust?

Can we create a full fledged CRUD application(login form) in RUST?

Yes.

1 Like

I have created a web application, in which I am able to create user inputs, but I want to perform CRUD on that application.Can you please guide me?

How you do that will depend on which web framework you are using.

Most frameworks/libraries will have some sort of Getting Started guide or documentation explaining how you can handle form submission, validate the inputs, then attach some sort of session cookie to the response.

I have used Rocket and Diesel framework..

We use different buttons in html pages for CRUD. How to specify its respective function to be performed?

Yes, but some assembly required.

I used Actix+diesel and Askama.

Good thing is, they are at least ok at what they do. Actix is nice, Askama is awesome. Diesel has issues, documentation is poor and you need to work around things like grouping not being supported in a typesafe way. Putting it all together is what took most of the work. Main pain point was that I had to write my own session storage and authorisation code. Also don't bother with async, most libraries don't care about that yet.

Typesafe sql and templates are really worth the effort though.

1 Like

There are any tutorials for CRUD applications??

What have you looked at so far? Did you go through the guide on the rocket website?

Yes, I have gone through Rocket guide..

I have performed CRUD queries using Diesel. But I am not having an idea to link it with HTML.

ganeshkodaganti,

I am just starting on such a CRUD with Rust venture.

My plan is to use Rocket for the web server: https://rocket.rs/v0.4/overview/

I will be using the CockroachDB which can be accessed using the rust-postgres crate: https://github.com/sfackler/rust-postgres

I guess I could use the disel crate but that does not appeal to me just now.

The web pages, login forms etc will be created in javascript using React: https://reactjs.org/

Inspiration comes from this blog post: https://dzone.com/articles/creating-a-rest-api-in-rust-using-rocket-and-diese

All in all I'm attemptting to do in Rust what I would otherwise have done with node.js. I'm sure it's all possible.

I find this a good resource when looking at how languages/frameworks develop apps: https://github.com/gothinkster/realworld

2 Likes

I have downloaded and ran the code from the link https://dzone.com/articles/creating-a-rest-api-in-rust-using-rocket-and-diese. It is working, but how to perform POST, PUT and DELETE????

How do you generate the HTML?

Start by reading the Rocket documentation: https://rocket.rs/v0.4/guide/requests/

By the way, what's with all these "post withdrawn" posts of yours?

It seems that he's not editing the post if something changes, but rather deleting it and adding another one.

Typically I don't. I serve static HTML and React "generates" the page in the browser.

But there is always Handlebars templating: https://github.com/sunng87/handlebars-rust

I have added the function name to one of the url other than GET, but it isn't working

This was a question to @ganeshkodaganti, sorry for confusion.

What do you mean by "isn't working"? What's the error?