Running simple-http-server crate from toy rust program


I was wondering if its possible to start and run simple-http-server from within my program. I did add the simple-http-server as my dependency in my cargo.toml, however I dont know if its possible to start the server within my program. thank you for any help, or if you have other library recommendation that I can do what I am looking for.

simple-http-server = "0.6.8"

Perhaps you should have a look at tiny- http?

thanks! I will do that

Any ideas or examples I can use, how I can serve static contents like html, js, images, fonts etc. The examples in tiny-http are not really helpful to give a good starting point on building a http server to serve static contents.

simple-http-server is a binary meant to be used from the command line, and it serves static content. It is not a library to be added to your program.

tiny-http is a library that you can use to serve anything, including static content, but you have to do all the work yourself.

Your original question did not state what you wanted to do.

There may be other rust http libraries that can serve static content, I don't know, sorry.

You can check the documentation for any of the many other web frameworks:

Thanks! I used Axum