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
?
Asked
Active
Viewed 3,405 times
0

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

ColdHands
- 947
- 8
- 28
-
1You're probably better off just having your entire Cargo project inside the `server` folder. – Joe Clay Dec 05 '17 at 09:57
-
2this may be helpful http://doc.crates.io/manifest.html#configuring-a-target – user25064 Dec 05 '17 at 12:28
1 Answers
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