Other Data Servers
Learn how to spin up a server for special cases, such as rendering files, static HTML directories, and templating.
We'll cover the following...
We'll cover the following...
File or directory server
We occasionally need a server for special cases, not just to serve web pages. For example, we might need to show other kinds of files, or let the user download them. For this use case, warp comes to our rescue again with a simple solution.
In the code above, we pass the file /usercode/data.json to the response with warp::fs::file() in line 9.
The warp functionality can also serve a whole directory by mapping each ...