statics

expect fun Routing.statics(remotePath: String, basePackage: String?, index: String? = "index.html")

Sets up Routing to serve resources as static content. All resources inside basePackage will be accessible. If requested resource doesn't exist and index is not null, then response will be index resource in the requested package. If requested resource doesn't exist and no index specified, response will be 404 Not Found.

On JVM, staticResources is used by default. If you want to use files from some directory instead of .jar file, use com.sanyavertolet.statics.alternativeStatics (not recommended)

Parameters

remotePath

http path that defines requests that fetch statics

basePackage

directory where all the statics are stored

index

name of a fallback file

actual fun Routing.statics(remotePath: String, basePackage: String?, index: String?)

Behaves just as staticResources(remotePath, basePackage, index)

If statics are located outside the .jar, use alternativeStatics(remotePath, basePackage, index)

See also

staticResources
actual fun Routing.statics(remotePath: String, basePackage: String?, index: String?)

Sets up Routing to serve resources as static content. All resources inside basePackage will be accessible. If requested resource doesn't exist and index is not null, then response will be index resource in the requested package. If requested resource doesn't exist and no index specified, response will be 404 Not Found.

Parameters

remotePath

http path that defines requests that fetch statics

basePackage

directory where all the statics are stored

index

name of a fallback file