Node.js proxy service for DocumentDB - node.js

We want to work with Azure DocumentDB from AngularJS SPA. I understand that it's best to have node.js proxy service as a middle tier in between them. I'm a .NET developer and having trouble creating it. Can you point me to any code samples for such proxy?

Azure provides the DocumentDB SDK for C#, you can refer to https://azure.microsoft.com/en-us/documentation/articles/documentdb-get-started/ for how to handle DocumentDB operations in C#.
And then, you can leverage the API Apps in .Net implementing with the DocumentDB SDK for C#, to expose the APIs for your Angularjs SPA.

You can also use APIM (Azure API Management/Gateway) as a proxy or middle tier in between your SPA and DocDB. This way you don't have to code your middle tier but use APIM which is a PaaS service and also provides rich set of functionalities.

Related

How do I authenticate against Azure (subscription) from an external program

I am trying to develop a web application using which I want to be able to connect to my Azure subscription, read all my resources and display those back on my app. I only need the name, IP and resource type. I know I can authenticate against Azure using PowerShell but not quite sure how I achieve this using PHP.
Most Azure service REST APIs have client libraries that provide a native interface for using Azure services.
.NET
Java
Node.js
Python
Azure CLI 2.0 SDK
We do not have a client library for PHP. I would recommend call the Azure REST API from PHP to accomplish the task you are looking at.
https://learn.microsoft.com/en-us/rest/api/azure/
Authentication is also discussed in the link above.

Api Apps Vs Api Management

I am looking for scalable hosting for an API but I am getting a little confused with Azure. Ideally I want something that means I don't have to manage OS updates and security, just deploy my API code.
Is this possible with Azure? What do I need to sign up for?
In general, you are looking for the Platform as a service offer. Check What is PaaS?. For the API deployment you should check the Azure App Services. Azure API Management is for advanced API management or when you want to expose multiple APIs using a single gateway.

How to build a Rest API on Azure for a Documentdb database with Node.js

I have already created a Documentdb database and now i should build a REST API on Azure with Node.js. I have read the documentation, but i did't understand it good enough.
Cloud services could be a good solution, but if i didn't misunderstand, it is Python and .NET based.
If i want to build a REST API and an user interface voor the REST API, which services should i better use? Web apps? API apps? Or any another product?
https://learn.microsoft.com/en-us/azure/app-service-api/app-service-api-nodejs-api-app
Per Azure's documentation,
An API app can take advantage of features offered by Web Apps and Mobile Apps. The reverse is also true: if you use a web app or mobile app to host an API, it can take advantage of API Apps features such as Swagger metadata for client code generation and CORS for cross-domain browser access. The only difference between the three app types (API, web, mobile) is the name and icon used for them in the Azure portal.
An API app and a Web app will equally work for you. Currently, all of Web, Mobile and API Apps are collectively called App Services. For most scenarios, Web Apps is the best choice.
More on this:
Azure Web API vs Web App
Differences between Azure App Services and Cloud Services

mobile service API or .net Web API for querying azure SQL data

I am going to develop a mobile app, its bit of social kind of app.
For data, I am planning to use Azure SQL for hierarchical data and Azure Storage for images etc.
Now for user authentication, I want my users to log in using oAuth providers such as Facebook/google/live etc rather than developing a user authentication of my own.
So for oAuth, I am planning to use Azure Mobile Services.
The thing I am not clear is after I authenticate user using Mobile Services, how I go to query the user's data that is in Azure SQL . Should I use the APIs that I can write in Node.js from Mobile Services or should I develop a WebAPI project to talk to data.
Using Mobile Service's node.js API looks easy and simplest way, but the apprehension I have with querying data from Mobile Service is it allows to query the tables that are in its own schema. If I wish to have some tables in some other logical schema, I won't be able to query it from Mobile services. Is my understanding correct here?
.net WEBAPI will be my preferred way of talking to database,but if I write a WebAPI, how do I get user's Identity carried from Mobile Services to WebAPI.
if someone can point me to some example/sample of using using Web API and Mobile Services together, will appreciate
thanks in advance.
Mobile Services would allow you to access table's outside of its schema, although it is more work. You can use the MSSQL object to talk to additional schemas. See: http://www.windowsazure.com/en-us/documentation/articles/mobile-services-how-to-use-server-scripts/#TSQL
The new .NET runtime, currently in preview, also has support for using multiple data sources.
I would keep azure mobile services for authentication. You can then create your full schema in SQL where your user is nothing more than the userid from mobile services.
In code you end up with this user id after authentication. From that point forward everything is in SQL.

Windows Azure Mobile Services management API

Is there any management API in Windows Azure Mobile Services?
For example: methods to create mobile services or data tables.
There's a Mobile Service Management API however it is not publicly available yet. One thing you could do is take a look at the source code for Windows Azure CLI tools and figure out how this API has been implemented. You can view the source code on GitHub: https://github.com/WindowsAzure/azure-sdk-tools-xplat.

Resources