Azure Website - Query Azure Database with REST - javascript

I currently have a basic html/js/css web app being hosted on Microsoft Azure. What I need to do next is pull some data an Azure SQL database onto one of the pages using REST calls.
Does anyone know what steps I need to take in order to accomplish this?

I built my own Web API in VS 2015 for my database and deployed it to azure that way. See reference below:
http://www.infragistics.com/community/blogs/dhananjay_kumar/archive/2015/06/05/a-step-by-step-guide-to-working-with-the-asp-net-web-api-and-angularjs.aspx

Your question is too board. There are many ways can satisfy your requirement. Generally speaking, you need to build a backend service to connect to your SQL Database and provide REST APIs service.
On Azure, you can quickly acquire this via Web Apps or API Apps. However, all the operations to Azure SQL database need you to implement by yourself depend on which develop language you are using. You can refer to https://azure.microsoft.com/en-us/documentation/articles/sql-database-get-started/ for more details.

Related

Store and edit data using ReactJS

I am building an application using ReactJS. I am trying to find out how to store data and to edit it. I tried to store it on my computer with 'fs, 'browserify-fs' but it didn't work.
Should I use express, or is there any other alternatives ?
If you are using React you are operating in the browser. Your option for storage is in local storage. This is explained here.
Examples of code are:
// setter
localStorage.setItem('myData', data);
// getter
localStorage.getItem('myData');
// remove
localStorage.removeItem('myData');
// remove all
localStorage.clear();
Note this is stored in the browser and can be easily cleared. You are going to realize that you need a back end solution. This is a server you can send requests to which has an API (a place you send requests to) which executes some form of operation (normally CRUD - Create Read Update Delete via a REST endpoint or GRAPHQL) to serve you back the data you are requesting from a database (MySQL, Postgres, MongoDB). This is a whole different discussion.
To store an array in local storage you will need to make it a string via JSON.stringify. An example would be:
localStorage.setItem("array", JSON.stringify(array));
In developer tools in Chrome you can go to Application -> Storage -> Local Storage and see what is saved. Here is an example:
If you want to share the data along multiple clients you should use server-side solution or if you just want to save the data for a client only you could use client-side solution provided by #diesel.
Create your own web-server
You need to create web server and a database to store your data. Database is used to store data. You could use: MySQL, PostgreSQL, SQLite3, MongoDB, ... You also need to create web service to make secure database calls.
To create web server you could use Express.js to write your web server easily.
Headless Content Management Systems (abbr: CMS)
If you don't want to spent time on creating your own web-server you could install a headless CMS to read/write your data using api endpoints provided by CMSs. Here's list of headless CMS softwares: headlesscms.org. I tried strapi which has lots of features you might need.
Here's some strapi features:
Open-source
Model builder
Extensible (plugin support)
Content editor (eg: to edit articles)
and many more
Firebase
If you don't want to spend your time on installing CMS software to your server and maintaining it regularly you could use Database service provided by Google Firebase. It is also feature rich too. Here's some features supported by Firebase.
NoSQL Database (to store your data)
Authentication (to authenticate users)
Storage (to store files)
Functions (to write serverless functions)
Machine Learning
and many more

How would I transfer data from a Node.JS web app to a JavaScript client on another website/server?

I have a Node.JS backend running on Heroku which pulls data from a Google sheet. This app will run once a day to pull updated data from the Google Sheet.
I also have a client written in HTML, CSS & JS which will need to draw that data from the backend.
The problem is, the client runs on a different server than than the Node.JS backend. This means I have to have the Node.JS backend update some form of database, then have the client download that data.
Some important information:
I don't have access to the client server, but of course I can access the backend.
I only need to transfer a very small amount of data (only 4 pieces of data).
I am doing this as a volunteer project, and therefore anything suggested needs to be free.
These are the options I have considered:
Option 1: Use Heroku Postgres
This is the option I initially wanted to use. However, I learnt that the credentials to access the database change every so often, so that means the final product may not be completely hands-free.
Option 2: Find an external SQL database host
This is the more likely option of the two. However, I've found that many free database host are insecure and difficult to use. I had a look at 000webhost, but I quickly learnt the database was hosted on localhost - this meant it couldn't be accessed by my client.
Which of these options, if any, are the best? What other methods can I use to accomplish this? Could someone please give me some recommendations on services which I could use?

IBM MobileFirst 8.0 integrate with Integration Bus

For our mobile apps we implemented our adapters using JavaScript where procedures simply do MFP.Server.invokeHTTP. But now we need somehow integrate with IBM Integration Bus (IIB), and I can't find any information how to do it.
I have only limited knowledge how Integration Bus works and why it needs.
Is it possible to do it with JavaScript or it possible only in Java (also all examples, that I found - it simple how to create services for IIB)?
Should we configure MobileFirst Server (via Operation Console) to connect to IIB or we need import additional packages?
If I get it correct you are already calling web services via HTTP .
IIB provides you web services like REST SOAP... in your case you can simply ask your team (IIB ) to build services as REST and expose them... from you mobile server you can simply call them like any other service... like you can provide the IIB rest service url in you http method and get resoonse back.

Google Cloud Datastore REST API from a browser

I search if it's possible and how calling Google Cloud Datastore REST API
from a browser with JavaScript.
I know this is possible from Node.js :
https://cloud.google.com/datastore/docs/reference/libraries#client-libraries-install-nodejs
But I don't find any example how to do that from a React.js or Angular application.
My application is not critical and I don't want to create fat Java endpoint in my back-end.
I believe this is what you are looking for -
https://cloud.google.com/datastore/docs/reference/rest/

Javascript that communicates with a Hosted API?

Basically I'm developing .NET API that allows a certain Javascript to access a Database through it. The database contains User Information and the API is the mediator between the client (running the javascript on their websites) and the database. The javascript simply gets the data from the DB and displays them.
My problem is, where do I host my API so that the client Javascripts can access it? What is this system called? I'm using Microsoft Azure SQL Databases to store the user information. How do I access my C# API from the client's javascripts? Do I need to host my API on Azure's API Hosting service? Very confused.
1) Client adds the Javascript and a HTML div to their website
2) The Javascript should access the API
3) API accesses the Database and gets the Data (Which is completed and it works)
4) Send the Data to the client and the javascript populates it
I just need to figure out how to make a connection between the API and the javascript on the client's website
Do I need to use THIS?
I would use ASP.NET Web.Api. It allows you to build a REST endpoint in C# that you can host on the Azure platform as well. You will be able to host it using the web sites features of Azure. Even though you want to build an API not a web site hosting it in a web site container will give you what you need:
Easy hosting solutions
Web endpoints for your client JavaScript to consume
C#.NET
Web endpoints close to your database. (Host them in the same data center)
Scalability
Monitoring
Ability to create a web site at the same address if you need to.
I haven't used Azure api management so I can't comment on that, but you will be able to get an ASP.NET Web.Api site up very quickly.

Categories