←back to thread

319 points levkk | 6 comments | | HN request time: 0.955s | source | bottom

Hi everyone,

I've been "funemployed" for a few months and with all that free time and idle hands I wrote a full web framework (think Rails, not Flask) for Rust.

It's boring old MVC, has its own ORM, templates, background jobs, auth, websockets, migrations and more. If you're keen but don't feel like rewriting your app in a different language, Rwf has a WSGI server to run Django (or Flask) inside Rust [1], letting you migrate to Rust at your own pace without disrupting your website.

I think Rust makes a great prototyping and deploy straight to production language. Now it has yet another framework for y'all to play with.

Cheers!

[1] https://levkk.github.io/rwf/migrating-from-python/

Show context
alberth ◴[] No.41914974[source]
Does Rust have any DSL for web use (e.g. Rails in someways is a DSL to Ruby)?

I ask because I imagine a simplified (Rust) syntax would be more inviting to newcomers.

replies(1): >>41914994 #
1. levkk ◴[] No.41914994[source]
Yup, they are called "macros". Rwf uses a few of them, some of which you'll find familiar, e.g. `render!` which returns a rendered template with HTTP 200 [1].

[1] https://levkk.github.io/rwf/views/templates/templates-in-con...

replies(1): >>41915025 #
2. alberth ◴[] No.41915025[source]
That's good to know.

From the ReadMe example, is there a way to use macros to simplify the following line of code:

  async fn handle(&self, request: &Request) -> Result<Response, Error> {
I ask because many web developers don't come from a C/C++/Rust background - so the line above will be jarring/off-putting to many.

(Awesome project btw)

replies(4): >>41915066 #>>41915092 #>>41915118 #>>41915139 #
3. levkk ◴[] No.41915066[source]
Thanks!

Yes, I was thinking of adding a shorthand for that. Will add something soon!

4. fkyoureadthedoc ◴[] No.41915092[source]
You might be surprised, with Typescript's ubiquity in the web space the type definitions probably won't be too scary. I've never used Rust but I assume `&` is some kind of Rusty pointer.
5. Scarblac ◴[] No.41915118[source]
Coming from Typescript that doesn't look very ominous to me, though it would nice if the types could be inferred somehow.
6. afavour ◴[] No.41915139[source]
Rust can be an intimidating language but the example you’ve provided there really shouldn’t be intimidating to anyone that’s using TypeScript today. There’s a little learning to with &self and & but that’s really basic Rust stuff. I don’t think it’s wise for a framework to attempt to hide core components of the language.