Skip to content

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 😄

@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'
@eltyBelgium eltyBelgium requested a review from Badgerati June 24, 2024 07:58
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 😄

@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 .

@eltyBelgium eltyBelgium requested a review from Badgerati February 1, 2025 19:15
@Badgerati Badgerati added priority: low Optional, no set timeline. Might be added in a future release if relevant story-points: 3 Low complexity. Small features or minor refactors. Some review required, but fairly straightforward labels Feb 22, 2025
@mdaneri
Copy link
Contributor

mdaneri commented May 9, 2025

Add-PodeStaticRouteGroup function is missing the SYNOPSIS description for FilePath parameter

.PARAMETER FilePath
A literal, or relative, path to a file containing a ScriptBlock for the Route's main logic.

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

Labels

enhancement ⬆️ priority: low Optional, no set timeline. Might be added in a future release if relevant story-points: 3 Low complexity. Small features or minor refactors. Some review required, but fairly straightforward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PodeRouteGroup with a file path

3 participants