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

app ArcApplication

The ArcApplication.

filePath string

The 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

app ArcApplication

The 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

app ArcApplication

The ArcApplication.

options StaticFileOptions

The 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

app ArcApplication

The ArcApplication.

configure Action<StaticFileOptions>

An action to configure the static file options.

Returns

ArcApplication

The ArcApplication for continuation.