Recently we made a post with Google Cloud and AWS comparison. But we promised to include there Microsoft Azure. While we’re still working on that you might enjoy the example of creating a serverless API using Microsoft Azure. What if you want or need to make your own API? Serverless can help create a nice one for data you’d like to expose for use. Here we’ll be able to create an API in a few button clicks, with minor modifications.
- To get started, if you haven’t already, create a free Azure trial account, create a new function using HTTP Trigger and when the initial part is all set up, find a place to host your data.
- Then sort the data using the CosmosDB. We can manually create them by going to Data Explorer in the sidebar.
- Connect it to the serverless function so you can finish up your API
- Don’t forget the CORS. Back in the portal, click on the function name and click on Platform Features. CORS is listed under the API heading.
- To make sure the API is working and you can access its data from an application, use an axios call.
From here, you have all that data to play with, and you can store whatever you like in whatever form you fancy. You can use something like Vue, React, or Angular to create interfaces with the content we stored in our database, and your serverless function creates the API for you.
The detailed code can be found in this material.