tokio-rs / axum

Ergonomic and modular web framework built with Tokio, Tower, and Hyper
19.03k stars 1.06k forks source link

add static web server. #2898

Closed zhangwuqiao closed 2 months ago

zhangwuqiao commented 2 months ago

Is it possible to introduce static web server as a static file server and integrate it into Axum to facilitate the development of front-end and back-end separated applications by directly placing front-end projects in the folder corresponding to static files and accessing the interfaces developed by Axum's web server for project development?

If necessary, this can be done without using Apache/nginx to provide services for HTTP.

Of course, if it is a very large project, separating the front and rear ends is also an option.

https://github.com/static-web-server/static-web-server

ttys3 commented 2 months ago

a static file server is as simple as https://github.com/tokio-rs/axum/tree/main/examples/static-file-server

or you can check https://github.com/ttys3/static-server

you do not need the static-web-server.

you can also use caddy, why not?

jplatte commented 2 months ago

As pointed out, we have an example for this based on tower-http. We're not going to integrate this into axum itself, it wouldn't really have any unique benefits.