Echo can be used for testing various integrations and webhooks. It echoes back the request headers and request body, so you can study content better.
# Build container image
docker build . -t echo:latest
# Run container using command
docker run -it --rm -p "8080:8080" echo:latest
Using curl
:
curl -d '{ "firstName": "John", "lastName": "Doe" }' -H "Content-Type: application/json" -X POST http://localhost:2001/api/echo
Using PowerShell
:
$url = "http://localhost:2001/api/echo"
$data = @{
firstName = "John"
lastName = "Doe"
}
$body = ConvertTo-Json $data
Invoke-RestMethod -Body $body -ContentType "application/json" -Method "POST" -DisableKeepAlive -Uri $url
Using Visual Studio Code with REST Client extension:
### Invoke Echo
POST http://localhost:2001/api/echo HTTP/1.1
Content-Type: application/json; charset=utf-8
{
firstName: "John"
lastName: "Doe"
}
Deploy published image to Azure Container Instances (ACI) the Azure CLI way:
# Variables
aciName="echo"
resourceGroup="echo-dev-rg"
location="westeurope"
image="jannemattila/echo"
# Login to Azure
az login
# *Explicitly* select your working context
az account set --subscription <YourSubscriptionName>
# Create new resource group
az group create --name $resourceGroup --location $location
# Create ACI
az container create --name $aciName --image $image --resource-group $resourceGroup --ip-address public
# Show the properties
az container show --name $aciName --resource-group $resourceGroup
# Show the logs
az container logs --name $aciName --resource-group $resourceGroup
# Wipe out the resources
az group delete --name $resourceGroup -y
Deploy published image to Azure Container Instances (ACI) the Azure PowerShell way:
# Variables
$aciName="echo"
$resourceGroup="echo-dev-rg"
$location="westeurope"
$image="jannemattila/echo"
# Login to Azure
Login-AzAccount
# *Explicitly* select your working context
Select-AzSubscription -SubscriptionName <YourSubscriptionName>
# Create new resource group
New-AzResourceGroup -Name $resourceGroup -Location $location
# Create ACI
New-AzContainerGroup -Name $aciName -Image $image -ResourceGroupName $resourceGroup -IpAddressType Public
# Show the properties
Get-AzContainerGroup -Name $aciName -ResourceGroupName $resourceGroup
# Show the logs
Get-AzContainerInstanceLog -ContainerGroupName $aciName -ResourceGroupName $resourceGroup
# Wipe out the resources
Remove-AzResourceGroup -Name $resourceGroup -Force