Azure App Service allows developers to build, host, and scale web apps, RESTful APIs, and mobile backends quickly without worrying about managing the underlying infrastructure. It is fully managed by platform as a service (PaaS).Think of it as a ready-to-use web hosting platform in the cloud, where you focus on your code and business logic while Azure takes care of servers, operating systems, scaling, load balancing, and security patches. It can scale automatically, vertical and horizontal with set rules (CPU%, memory, request count etc.),thereby increasing performance.
Types of Apps You Can Host on App Service
- Web App (Websites and web applications)
- API Apps (REST APIs for use by web, mobile, or IoT clients.)
- Mobile Apps(Backend services for mobile apps(push notifications, offline sync, etc.)
- Azure Function (Serverless event-driven apps. Though Functions is a separate service, but it runs on the same underlying infrastructure as App Service).
In this article, we are going to create a dummy code and use Azure App service to host the code. In other to create App service application we need three things:
- A resource group.
- A plan ( The plan determines the compute resources to be used).
- An empty Web Application.
In the article we are going to generate a code from chatGPT and host it in Azure App service.
1.To create a dummy code, go to chatGPT ,in the search portal ask chatGPT to "give you a sample html, CSS and JavaScript for a simple Chess game" and click enter to generate the code by chatGPT,.Because this is Platform as a service, we are only coming with the code to host it on Azure infrastructure.
2.Login to your Azure portal.
3.In your Azure portal, in the search resources, search for Azure App services. Click to open the selected App service.
4.Select + Create and choose Web App.
5.On the Basics,under Project details,select the Subscription and create Resource group.
6.Still on the Basics, under the Instance details, choose a name to fill the part of the empty Web App. The next things we are going to do is to choose Code as the publish because we are using code and not container, choose your Runtime stacks .NET 8, then your operating system, in App service we have only two operating system Linux and windows but we are going to choose windows for the article. Then we choose the region.
7.Under the Pricing Plan, we choose/create the windows plan and the pricing plan, remember the Plan determines the compute resource.
8.Select Review + Create and wait for validation pass.
9.After the validation is passed, select Create.
10.Wait for Complete deployment. Go to resource
11.In other to see that empty web application was create, open the default domain link in another tab.
12.On the resource, go to the search menu and search for Advanced Tools.Then click on GO
13.It will ask you to sign in and then It will open a tool for you that you will use to interact and upload your code.
14.Select Debug console and choose CMD.
15.In CMD select the site.
16.Select wwwroot
17.Click on the pencil icon
18.A white page will prompt up with a line of code which is responsible for showing us an empty web App.
19.Go to chatGPT and copy the code for the Chess game generated by chatGPT .
20.Delete the default code on CMD and paste the code you copied from chatGPT. And save it'
21.Go back to Azure portal, on the web App overview page, click on the default domain link.
22.Verifing the code ( for the chess game) we hosted on the App service. THE CHESS GAME!
Top comments (0)