Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
callback: async (context, request) => {
return {
status: 200,
headers: {
"content-type": "application/json",
},
body: {
time: new Date(),
greeting: `Hello ${request.query["name"] || "friend"}!`,
},
};
},
});
// Create an API Management Service instance
const service = new azure.apimanagement.Service("greeting-service", {
resourceGroupName: resourceGroup.name,
sku: {
name: "Developer",
capacity: 1,
},
publisherName: "YourCompany",
publisherEmail: "api@yourcompany.com",
});
// Create the API definition and map it to the HTTP Function backend
const api = new azure.apimanagement.Api("greeting-api", {
resourceGroupName: resourceGroup.name,
apiManagementName: service.name,
displayName: "Greetings",
path: "hello",
protocols: ["https"],`,
});
// Create an API Management product
const product = new azure.apimanagement.Product("greeting-product", {
resourceGroupName: resourceGroup.name,
apiManagementName: service.name,
productId: "greeting",
displayName: "Product for Greetings",
published: true,
subscriptionRequired: true,
});
// Link the API to the Product
const productApi = new azure.apimanagement.ProductApi("greeting-product-api", {
resourceGroupName: resourceGroup.name,
apiManagementName: service.name,
apiName: api.name,
productId: product.productId,
});