Ops / IT Pro
The course is part of these learning paths
There's a lot of effort that goes into keeping our applications available, and secure. That's why so many cloud vendors offer platforms for hosting web-based applications. If you're building web apps, APIs, mobile backends, or business processes then you should consider looking into App Service! App Service has a lot of functionality. It meets compliance standards from around the world, it's highly scalable, it supports multiple languages and makes it easy to get your code deployed.
This Getting Started with Azure App Service course it's basically an intro, but for developers and IT Pros. In this course, you'll learn about the features of App Service at a high level as well as for each component. Then you'll learn about each of the 4 components of App Service through some demos. If you're a developer or IT Pro working with Azure, but new to App Service, this course is for you.
This course will help get you up-to-speed on App Service so that you can start developing / managing apps.
Getting Started With Azure App Service: What You'll Learn
|Lecture||What you'll learn|
|Course Intro||What to expect from this course|
|App Service Overview||A high-level overview of App Service|
|Web, Mobile, API App Overview||A high-level overview of Web, Mobile, API Apps|
|Logic App Overview||A high-level overview of Logic Apps|
|Mobile Apps: Easy Tables||How to use Easy Tables as a "no-code" option|
|Mobile Apps: Client||Running the client code from an iOS simulator|
|Mobile Apps: .NET Backend||Using a .NET backend|
|Mobile Apps: Auth||Using authentication with App Service|
|API Apps||Creating API Apps|
|Logic Apps||Automating business processes|
|Web Apps||Authentication and remote debugging|
|Deployments||Deployment slots and GitHub based deployments|
|Monitoring and Logging||Monitoring and logging options|
|Scaling||Scaling up and out|
|Next Steps||What's next|
Welcome back! In this lesson we’ll pick up where we left off in the previous lesson. We’re going to run the solution we downloaded in the previous lesson and see how it works.
I have the solution loaded here in Visual Studio for Mac, which in itself is a pretty awesome thing!
Before we run this, let’s check the table in the Azure portal to show that there’s no data loaded. So under easy tables, select the TodoItem table that was automatically created for us as part of the quick start. Notice the table is empty, so now let’s go back to Visual Studio, and run this project.
It’s going to fire up the simulator, and get the code running on it. So, here it is all loaded up, and it’s a pretty basic todo list. Let’s start adding some entries to get them saved to the database.
Let’s add a record for “test”, and one for “cloud” and how about another for “Azure.”
Okay, so now if we jump back into the portal, and refresh the table we should see these records. Let’s see if I’m right…
And there they are, along with some additional metadata columns.
So now you’ve see it all working, however we still haven’t seen how it works. So let’s start going through the code to better understand how this works.
First let’s look at the packages that are being used for this project. Notice the Microsoft.Azure.Mobile.Client library, this allows you to interact with the Mobile Apps back-end from Windows and Xamarin projects.
Then there are some additional Microsoft libraries that are requirements of the Microsoft.Azure.Mobile.Client. Followed by some SQLite libraries used to allow offline sync.
If we look at the main.cs, this is just some boilerplate code for a Xamarin.iOS app. Then there’s this view controller, which is something you might be familiar with if you’ve done iOS development.
The important part for now is to make note of the code inside of the ViewDidLoad method, which sets up the default QuickStart todo service, and then runs some initialization code. So let’s check out the TodoService, because that’s where all the interesting stuff is happening.
Notice the top of this file has a comment about using offline sync. This is one of the features that makes Mobile Apps a great option; because implementing this for yourself takes some time to work out. The way it works is that if a device is offline it’ll save any data to a local SQLite database; once the device has connectivity again, it’ll sync up the data.
Scrolling down you can see on line 27 the URL to our app is stored in the applicationURL variable. This points to your Mobile App’s endpoint.
On line 29 a MobileServiceClient is declared. Then on line 30 you can see we have some compile time directives to conditionally use the offline sync code or not. Since offline sync isn’t enabled look at line 35, which defines a todoTable variable.
On line 39 some initialization code is run based on the current platform, this is to make sure any platform specific code is run.
On line 43 we instantiate the client by passing the applicationURL to the MobileServiceClient.
The client is how we interact with the Mobile App back-end, for example notice on line 52 it’s used to create the todoTable.
On line 56 there’s a DefaultService variable to return the QSTodoService as a singleton.
Then on line 62 is an Items variable that is a List of TodoItems used to display the items on the user interface.
The next couple of methods don’t apply in this case, since they’re both for offline sync.
On line 96 is the RefreshDataAsync method that’s used to refresh the items in the Items variable. It makes sure that any todo items from the server that aren’t already complete are added to the list.
To create a new todo item, the InsertTodoItemAsync method allows you to persist a new todo item to the database, it also adds it to the Items variable to make sure the UI reflects the addition.
And finally there’s a complete item method that will set a given todo item to complete. Because what’s the use of a todo list if you can’t complete the items. So that’s a high level review of the todo list client side code.
Mobile Apps are just a back-end database and API for your clients. If you’re looking for a back-end solution that doesn’t require much coding you should consider using Easy Tables. As you can see, with very little effort you can get a an API and database table setup. And under the Easy Tables option, you can add and remove tables, as well as edit their schemas.
If you need to do something more complex, then you’ll want to go with an option that allows you more control over the code and database. That option could be based on Node.js, however it’s often .NET.
So that’s what we’ll check out in the next lesson, we’ll see how to use a .NET back-end. Alright, I’ll see you in the next lesson!
About the Author
Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.