resources #
fn new #
fn new(config ResourceServerConfig) !ResourceServer
new_asset_server configures and creates a new resource server
struct Resource #
struct Resource {
name string
path string
acl auth.AccessControlList
}
struct ResourceServer #
@[noinit]
struct ResourceServer {
vweb.Context
pub mut:
auth auth_server.Client
assets []Resource @[required; vweb_global]
logger &log.Logger = &log.Logger(&log.Log{
level: .debug
}) @[vweb_global]
}
fn (ResourceServer) before_request #
fn (mut server ResourceServer) before_request()
before_request is a middleware that authorizes all requests made to resource endpoints
fn (ResourceServer) index #
fn (mut server ResourceServer) index(path string) vweb.Result
wildcard path that handles all requests to assets
fn (ResourceServer) not_found #
fn (mut server ResourceServer) not_found() vweb.Result
struct ResourceServerConfig #
struct ResourceServerConfig {
auth Authenticator @[required] // Authenticator to be used
assets []Resource @[required]
logger log.Logger
}