The HTTP trigger is normally used to create the API or services, where we request for data using the HTTP protocol and get the response. We can also integrate the HTTP trigger with a Webhook.
Let's start creating the HTTP trigger. We have already created a simple Azure Function and trigger. Now we will create the HTTP Login API. In this, we will send the login credential through an HTTP post request and get the response as to whether the user is valid or not.
Since we have already created a Function app in the previous example, we can now add multiple functions to it.
- Click on
+
|, selectHttpTrigger-JavaScript,
provide the function name, and click on theCreate
button:
- After we click on the
Create
button, the default template will be available. Now, we can edit and test the function:
- Now edit the code as follows:
- Save and run the code, as shown in the following screenshot:
- The login service is ready. Now let's check this service in Postman.
- To get the
URL
from the function, click on...