Compiling with conditions ,if production or development


#1

Hi , I am new in Rust .

I am writing a web app , I want conditions if the app is compiled for production vs in development.

To be specific it’s one of the routes , In development I serve static files with Hyper in Production I serve with nginx.

Thank you


#2

We don’t have any built-in flags to do this.

That said, usually, this wouldn’t matter: you’d set up nginx to only redirect the dynamic requests, so the static ones would never even get through.


#3

Thank you! did that for static files.It Works!

Just to add.
I am also using custom flags for conditional compiling for other uses ie database connection. I am working on perfecting a good workflow for web development