Can someone who is good at rust πŸ¦€ give me some feedback (aka roast) this code and let me know all the noob stuff I'm doing?

It compiles and tests pass but it feels ugly

https://github.com/utxo-one/relaying-rs/blob/master/src/handlers/relay_handler.rs

Reply to this note

Please Login to reply.

Discussion

Try ask to chatgpt...

ChatGPT is a clown and doesn't know anything

Lmao savage

Wish I was an expert in rust, all I can say is don’t forget to handle the unwraps :)

Consider creating a struct object and then implementing methods like this:

https://doc.rust-lang.org/rust-by-example/fn/methods.html

Relay would be your struct. Then you would implement methods like create, read, update and delete.

I’m a novice so ask around. This is just what I do.

πŸ‘¨β€πŸ’»πŸ«‚

Also this nostr relay written in rust might serve as some form of inspiration

https://github.com/scsibug/nostr-rs-relay