Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Kat Marchán 🐈
@zkat@toot.cat  ·  activity timestamp 3 months ago

Dear #rust#RustLang folks who use #axum

Do you have a nice router crate you recommend? My use case here is that I have a lot of situations where I want to actually resolve routes (to generate links and the like) and I really dislike how untyped/unverified those random strings are.

https://crates.io/crates/axum-routes seems good, but it's somewhat low usage. Still, it's pretty small and seems to do exactly what I need (lets me keep separating route definition from handler definition, lets me do reverse lookups, does static route typing, etc)

  • Copy link
  • Flag this post
  • Block
Kat Marchán 🐈
@zkat@toot.cat replied  ·  activity timestamp 3 months ago

sickosyes.png

nice statically-verified URL for the Home route instead of a hardcoded string in an HTML template
nice statically-verified URL for the Home route instead of a hardcoded string in an HTML template
nice statically-verified URL for the Home route instead of a hardcoded string in an HTML template
  • Copy link
  • Flag this comment
  • Block
Greg
@gregdavis@hachyderm.io replied  ·  activity timestamp 3 months ago
@zkat you're writing a web server that renders html templates?
  • Copy link
  • Flag this comment
  • Block
Jocelynephiliac :reclaimer:
@twipped@twipped.social replied  ·  activity timestamp 3 months ago
@zkat tf…
  • Copy link
  • Flag this comment
  • Block
Sylvain Wallez
@swallez@mastodon.tetaneutral.net replied  ·  activity timestamp 3 months ago
@zkat axum-typed-routing sounds like what you're looking for? https://crates.io/crates/axum-typed-routing
  • Copy link
  • Flag this comment
  • Block
Kat Marchán 🐈
@zkat@toot.cat replied  ·  activity timestamp 3 months ago
@swallez I saw that one but it doesn't do the most important part to me, which is being able to look up routes with typed verification. Turns out axum_extra has a thing for that, so that's what I ended up using. :)
  • Copy link
  • Flag this comment
  • Block
Jeremiah Senkpiel
@Fishrock@mastodon.social replied  ·  activity timestamp 3 months ago
@zkat interesting I’ll have to try this
  • Copy link
  • Flag this comment
  • Block
Kat Marchán 🐈
@zkat@toot.cat replied  ·  activity timestamp 3 months ago
@Fishrock I tried it. It was not very good. Turns out axum-extra has a relevant thing built in and I think I like it much better
  • Copy link
  • Flag this comment
  • Block
Natalie
@natkr@hachyderm.io replied  ·  activity timestamp 3 months ago
@zkat axum_extra::routing (https://docs.rs/axum-extra/latest/axum_extra/routing/) adds a typed layer and lives in the regular #axum repo.

Haven't used it for anything huge yet, but it should handle your bullet points and I'm happy enough with it in Tyck. (https://codeberg.org/natkr/tyck)

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.3.21 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login