< Back
Add-PodePage
Post
NAME Add-PodePage
SYNOPSIS
Helper function to generate simple GET routes.
SYNTAX
Add-PodePage -Name <String> -ScriptBlock <ScriptBlock> [-Data <Hashtable>] [-Path <String>] [-Middleware
<Object[]>] [<CommonParameters>]
Add-PodePage -Name <String> -FilePath <String> [-Data <Hashtable>] [-Path <String>] [-Middleware <Object[]>]
[<CommonParameters>]
Add-PodePage -Name <String> -View <String> [-Data <Hashtable>] [-Path <String>] [-Middleware <Object[]>]
[-FlashMessages] [<CommonParameters>]
DESCRIPTION
Helper function to generate simple GET routes from ScritpBlocks, Files, and Views.
The output is always rendered as HTML.
PARAMETERS
-Name <String>
A unique name for the page, that will be used in the Path for the route.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
A ScriptBlock to invoke, where any results will be converted to HTML.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-FilePath <String>
A FilePath, literal or relative, to a valid HTML file.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-View <String>
The name of a View to render, this can be HTML or Dynamic.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Data <Hashtable>
A hashtable of Data to supply to a Dynamic File/View, or to be splatted as arguments for the ScriptBlock.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
An optional Path for the Route, to prepend before the Name.
Required? false
Position? named
Default value /
Accept pipeline input? false
Accept wildcard characters? false
-Middleware <Object[]>
Like normal Routes, an array of Middleware that will be applied to all generated Routes.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-FlashMessages [<SwitchParameter>]
If supplied, Views will have any flash messages supplied to them for rendering.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Add-PodePage -Name Services -ScriptBlock { Get-Service }
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Add-PodePage -Name Index -View 'index'
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Add-PodePage -Name About -FilePath '.\\views\\about.pode' -Data @{ Date = [DateTime]::UtcNow }
RELATED LINKS
SYNOPSIS
Helper function to generate simple GET routes.
SYNTAX
Add-PodePage -Name <String> -ScriptBlock <ScriptBlock> [-Data <Hashtable>] [-Path <String>] [-Middleware
<Object[]>] [<CommonParameters>]
Add-PodePage -Name <String> -FilePath <String> [-Data <Hashtable>] [-Path <String>] [-Middleware <Object[]>]
[<CommonParameters>]
Add-PodePage -Name <String> -View <String> [-Data <Hashtable>] [-Path <String>] [-Middleware <Object[]>]
[-FlashMessages] [<CommonParameters>]
DESCRIPTION
Helper function to generate simple GET routes from ScritpBlocks, Files, and Views.
The output is always rendered as HTML.
PARAMETERS
-Name <String>
A unique name for the page, that will be used in the Path for the route.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
A ScriptBlock to invoke, where any results will be converted to HTML.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-FilePath <String>
A FilePath, literal or relative, to a valid HTML file.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-View <String>
The name of a View to render, this can be HTML or Dynamic.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Data <Hashtable>
A hashtable of Data to supply to a Dynamic File/View, or to be splatted as arguments for the ScriptBlock.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
An optional Path for the Route, to prepend before the Name.
Required? false
Position? named
Default value /
Accept pipeline input? false
Accept wildcard characters? false
-Middleware <Object[]>
Like normal Routes, an array of Middleware that will be applied to all generated Routes.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-FlashMessages [<SwitchParameter>]
If supplied, Views will have any flash messages supplied to them for rendering.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Add-PodePage -Name Services -ScriptBlock { Get-Service }
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Add-PodePage -Name Index -View 'index'
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Add-PodePage -Name About -FilePath '.\\views\\about.pode' -Data @{ Date = [DateTime]::UtcNow }
RELATED LINKS