Class StaticFileExtensions
- Namespace
- Cratis.Arc
- Assembly
- Cratis.Arc.Core.dll
Extension methods for ArcApplication to serve static files.
public static class StaticFileExtensions
- Inheritance
-
StaticFileExtensions
- Inherited Members
Methods
MapFallbackToFile(ArcApplication, string)
Configures a fallback file to serve when no route or static file matches the request. This is typically used for Single Page Applications (SPAs) to serve index.html for client-side routing.
public static ArcApplication MapFallbackToFile(this ArcApplication app, string filePath = "index.html")
Parameters
appArcApplicationThe ArcApplication.
filePathstringThe path to the fallback file, relative to the static files directory (default: "index.html").
Returns
- ArcApplication
The ArcApplication for continuation.
UseStaticFiles(ArcApplication)
Configures the application to serve static files from the default "wwwroot" directory.
public static ArcApplication UseStaticFiles(this ArcApplication app)
Parameters
appArcApplicationThe ArcApplication.
Returns
- ArcApplication
The ArcApplication for continuation.
UseStaticFiles(ArcApplication, StaticFileOptions)
Configures the application to serve static files with the specified options.
public static ArcApplication UseStaticFiles(this ArcApplication app, StaticFileOptions options)
Parameters
appArcApplicationThe ArcApplication.
optionsStaticFileOptionsThe options for static file serving.
Returns
- ArcApplication
The ArcApplication for continuation.
UseStaticFiles(ArcApplication, Action<StaticFileOptions>)
Configures the application to serve static files with custom configuration.
public static ArcApplication UseStaticFiles(this ArcApplication app, Action<StaticFileOptions> configure)
Parameters
appArcApplicationThe ArcApplication.
configureAction<StaticFileOptions>An action to configure the static file options.
Returns
- ArcApplication
The ArcApplication for continuation.