0

I have a front-end project that has a lot of stuff in src folder, and I have the opportunity to also use Rust on the server side. All my Rust server files are in the server folder; how can I tell Cargo to run ./server/app.rs?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
ColdHands
  • 947
  • 8
  • 28

1 Answers1

8

As stated in the comments, you are probably better off just moving all of your code into the "server" directory. If you don't, you are going to be swimming uphill against defaults, which is not usually a great idea.

That being said, you can specify the path to the binary or library in your Cargo.toml:

[[bin]]
name = "quux"
path = "server/main.rs"
[lib]
name = "quux"
path = "server/lib.rs"

See also:

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366