-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
45 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<# | ||
.SYNOPSIS | ||
A sample PowerShell script to set up a HTTPS Pode server with a self-sign certificate | ||
.DESCRIPTION | ||
This script sets up a Pode server listening on port 8081 in HTTPS | ||
.EXAMPLE | ||
To run the sample: ./Web-SelfSigned.ps1 | ||
.LINK | ||
https://github.com/Badgerati/Pode/blob/develop/examples/Web-SelfSigned.ps1 | ||
.NOTES | ||
Author: Pode Team | ||
License: MIT License | ||
#> | ||
try { | ||
$ScriptPath = (Split-Path -Parent -Path $MyInvocation.MyCommand.Path) | ||
$podePath = Split-Path -Parent -Path $ScriptPath | ||
if (Test-Path -Path "$($podePath)/src/Pode.psm1" -PathType Leaf) { | ||
Import-Module "$($podePath)/src/Pode.psm1" -Force -ErrorAction Stop | ||
} | ||
else { | ||
Import-Module -Name 'Pode' -MaximumVersion 2.99 -ErrorAction Stop | ||
} | ||
} | ||
catch { throw } | ||
|
||
Start-PodeServer -Threads 6 { | ||
Add-PodeEndpoint -Address localhost -Port '8081' -Protocol 'Https' -SelfSigned | ||
|
||
New-PodeLoggingMethod -File -Name 'requests' | Enable-PodeRequestLogging | ||
New-PodeLoggingMethod -File -Name 'errors' | Enable-PodeErrorLogging | ||
|
||
Add-PodeRoute -Method Get -Path / -ScriptBlock { | ||
Write-PodeTextResponse -Value 'Test' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters