Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a -FilePath parameter to the RouteGroup functions #1331

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

eltyBelgium
Copy link

Description of the Change

Add Filepath parameter to the command PodeRouteGroup

Related Issue

A link/reference to the GitHub issue.

@mdaneri
Copy link
Contributor

mdaneri commented Jun 8, 2024

You should do the same with Add-PodeSignalRouteGroup.

@eltyBelgium
Copy link
Author

I will update it then... don't merge it yet :D

@eltyBelgium
Copy link
Author

You should do the same with Add-PodeSignalRouteGroup.

This one is added now! 😄

Copy link
Owner

@Badgerati Badgerati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good :)

Akin to the Add-PodeSignalRouteGroup above, the Add-PodeStaticRouteGroup will also need the same too.

It'll also be worth adding a quick mention to the new parameter in the docs at /docs/Tutorials/Routes/Utilities/RouteGrouping.md. At the bottom of the ## Routes section, a quick nod the the -FilePath parameter and an example will do 😄

src/Public/Routes.ps1 Outdated Show resolved Hide resolved
src/Public/Routes.ps1 Outdated Show resolved Hide resolved
src/Public/Routes.ps1 Outdated Show resolved Hide resolved
@Badgerati Badgerati linked an issue Jun 12, 2024 that may be closed by this pull request
The commit refactors the `Add-PodeRouteGroup`, `Add-PodeStaticRouteGroup`, and `Add-PodeSignalRouteGroup` functions to use the default parameter set for routes. This change allows for a more concise and consistent code structure. Additionally, it adds support for specifying a file path when adding route groups.

- Set the default parameter set to 'Routes' in `[CmdletBinding()]`
- Update the mandatory parameter attribute for `$Routes` in each function
- Add a new parameter, `$FilePath`, with mandatory attribute and 'File' parameter set in each function
- Modify the logic to check if `$Routes` is empty and handle it accordingly

Examples:
```
Add-PodeRouteGroup -Path '/api' -Routes { Add-PodeRoute -Path '/route1' -Etc }
Add-PodeRouteGroup -Path '/api' -FilePath '/routes/file.ps1'

Add-PodeStaticRouteGroup -Path '/static' -Routes { Add-PodeStaticRoute -Path '/images' -Etc }
Add-PodeStaticRouteGroup -Path '/static' -FilePath '/routes/file.ps1'

Add-PodeSignalRouteGroup -Path '/signals' -Routes { Add-PodeSignalRoute -Path '/signal1' }
Add-PodeSignalRouteGroup -Path '/api'
Copy link
Owner

@Badgerati Badgerati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some documentation to be added 😄


[Parameter(Mandatory = $true, ParameterSetName = 'File')]
[string]
$FilePath
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This -FilePath parameter is missing the .PARAMETER definition above the function

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the new -FilePath parameter, it'd be worth adding a quick mention of the parameter in the docs found at /docs/Tutorials/Routes/Utilities/RouteGrouping.md. At the bottom of the ## Routes section, a quick nod the the -FilePath parameter and an example will do 😄

@Badgerati Badgerati changed the title Issue #1329 Adds a -FilePath parameter to the RouteGroup functions Jul 9, 2024
@eltyBelgium
Copy link
Author

Just some documentation to be added 😄

I will fix them, sorry for the late response, I don't get notifications from Github... checking what is going on there .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PodeRouteGroup with a file path
3 participants