Development
Building APIs in VS Code.
The Visual Studio Code extension for PowerShell Universal provides integration for working with APIs. We recommend you also install the PowerShell extension.
You can add APIs by using the admin console or through the editor in Visual Studio Code.
To add an API in the Admin Console, you can visit
http://localhost:5000/admin/apis
and click Add Endpoint.
Once an
endpoints.ps1
file has been created, you can click the Open Endpoints.ps1 button within the API tree view to view the configuration file for APIs.
The configuration file uses the Universal PowerShell cmdlets to define the endpoints within Universal.
If you created a blank endpoint, it would look something like this.
New-PSUEndpoint -Url "/test" -Endpoint {
# Enter your script to process requests.
}
If you edit the
endpoints.ps1
file, it will update the API automatically. For example, if I added a new API, it would then appear in the admin console.New-PSUEndpoint -Url "/test" -Endpoint {
"hello"
}
New-PSUEndpoint -Url "/test2" -Endpoint {
# Enter your script to process requests.
}

Last modified 2yr ago