July 2018
Beginner
552 pages
13h 18m
English
The create method will let users create new files with customizable content. It will need one POST route and will accept JSON data containing the filename and the file contents. The following code sample creates the first route, as well as our Polaris middleware , which is executed every time a request comes in:
$polarisPath = [System.IO.Path]::GetTempFileName() -replace '\.tmp','\Polaris'git clone https://github.com/powershell/polaris $polarisPathImport-Module $polarisPath$middleWare = @" `$PolarisPath = '$polarisPath\FileSvc' if (-not (Test-Path `$PolarisPath)) { [void] (New-Item `$PolarisPath -ItemType Directory) } if (`$Request.BodyString -ne `$null) { `$Request.Body = `$Request.BodyString | ConvertFrom-Json } `$Request | Add-Member ...Read now
Unlock full access