scripts/server.ps1

param(
        [int]$Port = 80,
        [Parameter(Mandatory)]
        [ValidateSet("python_local_server","base_ngrok","ngrok_with_python")]
        [string]$Type
    )
Clear-Host
$absolute_root = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\"))
Write-Host "Python v3+ and ngrok are required for this script to work.`r`n"
Start-Sleep 3
if($Type -eq "python_local_server"){
py -m http.server --directory "$absolute_root" $Port
} elseif($Type -eq "base_ngrok") {
ngrok http "file:///$absolute_root"
} elseif($Type -eq "ngrok_with_python") {
ngrok http $Port
py -m http.server --directory "$absolute_root" $Port
}