-
Notifications
You must be signed in to change notification settings - Fork 0
Static files
Hayley edited this page Sep 12, 2020
·
1 revision
The StaticFile is a built in route to simplify serving static files. The signature of the StaticFile constructors are as follows
StaticFile(string filename, string path, string content_type);
StaticFile(string filename, string path);Where filename is the name of a server resource, path is the base uri path to listen on as the file name is appended to this value to get the path where the file is served from and content_type is the mime type of the file. If content_type isn't specified it will try to automatically detect it, falling back to text/plain if it's unknown.
An example of StaticFile in use is
int main() {
FireStorm()
.add_route(new StaticFile("favicon.ico", "/"))
.ignite(5000);
return 0;
}