Skip to content

Instantly share code, notes, and snippets.

@andrii-riabchun
andrii-riabchun / poshttp.ps1
Created September 25, 2016 12:52
Powershell static http server
#Requires -RunAsAdministrator
# Simple static http server.
Param(
[int]$port = 8080,
[string]$root = (Get-Location)
)
function Serve {
$listener = [System.Net.HttpListener]::new()
$listener.Prefixes.Add("http://+:$port/")