July 2018
Beginner
552 pages
13h 18m
English
The delete method will delete a specific file and will take its filename from a query parameter, as well as the JSON body. It uses a DELETE route, as you can see in the following code sample:
New-PolarisDeleteRoute -Path "/files" -Scriptblock { $fileName = if ($request.Query['Name']) { $request.Query['Name'] } elseif ($request.Body.Name) { $request.Body.Name } else { $response.SetStatusCode(501) $response.Send("File name may not be empty.") return } Remove-Item -Path (Join-Path $Request.PolarisPath -ChildPath $fileName)} -ForceStart-Polaris
The delete method again takes either a JSON body or a query parameter. Start-Polaris runs the server on port 8080.
Read now
Unlock full access