PowerShell / Polaris

A cross-platform, minimalist web framework for PowerShell
https://powershell.github.io/Polaris/
MIT License
512 stars 114 forks source link

Fix #17: Adding default files for static routes #141

Closed bateskevin closed 5 years ago

bateskevin commented 6 years ago

Edited the Function New-PolarisStaticRoute.ps1 in a way, that it will recognize default files in the folderpath where it points to. The other rules still get created recursively.

Supported default files (For now. Only have to extend the array $StandardHTMLFiles to add more):

Hope this suits your needs.

Cheers, Kevin

*Edit from maintainer: Link to Issue #17

msftclas commented 6 years ago

CLA assistant check
All CLA requirements met.

bateskevin commented 6 years ago

@Tiberriver256 Thanks for the feedback! I agree with your suggested changes. How does this usually work? Should I implement these Changes on my fork and make a new PR? I've never done this before :)

Tiberriver256 commented 6 years ago

If you make changes on your StaticRoutesDefaultFiles branch this pull request should automatically pick up on those changes and should highlight what's changed in the latest commits on that branch.

bateskevin commented 6 years ago

Ok, I'll try to apply the changes you suggested this weekend if I find some time.

TylerLeonhardt commented 6 years ago

gentle ping @bateskevin don't want this PR to disappear!

Tiberriver256 commented 5 years ago

@TylerLeonhardt - I updated with the suggested changes. I believe I've got it ready if you want to give it a quick look over when you get a chance.

I feel like there's some awkwardness around having a default file and a directory browser enabled at the same time. I'm not 100% sure what to do about it though. I was thinking parameter sets but ended up going with defaulting the directory browser to false, let me know if you have any other ideas.

TylerLeonhardt commented 5 years ago

Sorry for the delay! I think the behavior we're looking for is like what python does with:

python -m SimpleHTTPServer 8000

if there's a default file in the directory, we load that. If there is no default file, then we load the directory browser.

I'm not married to that idea though. What do you think @Tiberriver256?

Tiberriver256 commented 5 years ago

Sounds good to me. So I set the default value for directory browser and default files to true and made sure the check for default files is above the check to see if the $localpath variable is a container.

Should match python simpleHttpServer now.

Tiberriver256 commented 5 years ago

@TylerLeonhardt - Could you kick off the tests one more time for this? I think I should have it now.

TylerLeonhardt commented 5 years ago

why do they disappear sometimes 😆 Kicked 👍

bateskevin commented 5 years ago

Hey folks, sorry this went a little under my radar. Had no time to code in the last few weeks in my time off. Glad to see that this could be completed tho!

Tiberriver256 commented 5 years ago

@bateskevin - No problem man. Thanks so much for getting this started. Jump on another one any time if you like :)