What is CDN?

0 votes
Hello Ajay,

What is 'CDN'? Is that part of the App42 Cloud>

Regards,

Dan
asked Aug 17, 2014 in App42 Cloud API-BaaS by huffman (17 points)

1 Answer

0 votes
Hi Dan, 
 
App42 File Storage usage CDN network to store and access binary/media files. CDN (Content Delivery Network)  is distributed access network across the globe for accessing the files over HTTP. This provides faster access of file to the user as it is being served by near by CDN access location.   App42 CDN is located on 51 access location across the globe. Once you upload any file you will get an HTTP end point URL for that file pointing to CDN network. If you request that file in browser, it will be fetched from near by access location for faster response.
 
Let me know if it answers your query.
 
Thanks
 
Ajay
answered Aug 18, 2014 by ajay123 (899 points)
Thanks. When I upload the HTML/Javascript file using the Upload Service what filetype should I specify. I didn't see HTML in the dropdown list.
Yes, you can select Other option while deploying HTML5 file. HTML5 option is not there in drop down.
Hello Ajay.
I uploaded an HTML file and got the URL for that file. I put that URL into an email that I send to myself using your email service. I get the email with the URL to the HTML file I uploaded. When I click that URL my browser opens but instead of the HTML being displayed in the browser, that file that I previously uploaded to your server is downloaded to my machine.

The html is:

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    <title>Verify Email Addr</title>
    <link href="../css/create_user_style.css" rel="stylesheet" type="text/css">
    <link href="../css/jqueryAlert.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="../App42-all-2.6.min.js"></script>
    <script type="text/javascript" src="../jqueryAlert.js"></script>
    <script>
    function insertJSONDocument()
    {
        var storage = new App42Storage();
        var dbName = "TEST";  
        var collectionName = "TOTMPsubscriptions";
      
        var json = "{\"VERIFIED\":\"TRUE\"}";
        var result;
      
        storage.insertJSONDocument(dbName, collectionName, json,
          {
              success:function(object)
                      {
                          $(".success").show();
                          var storageObj = JSON.parse(object)
                          $('#success').html("Insert JSON Document");
                          jAlert('Document has been successfully Inserted',"Insert JSON Document");
                      },
              error:  function(error)
                      {
                      }
          }
        );
     }
      
    function verifyFunction()
    {
        App42.initialize("****","****");
        insertJSONDocument();
    }
    </script>
  </head>
  <body onload="verifyFunction()"> You are now able to play online
    multiplayer games in TOT.
  </body>
</html>
Hi Dan, Sorry for trouble. You have to select HTML option while uploading the file in AppHQ console. We have just added in our today's build. This option was there in API however was not available in AppHQ console. Choosing OTHER option while uploading the file made file type anonymous for browser  to understand. That is the reason it downloaded the file. Selecting HTML as file type will solve this issue.

Let me know if it helps.
Yep. That will help. Thanks.
Another question. In the mail service API example you use Google as the outgoing mail server (SMTP) . Is this just for demonstration? Is it a good idea to use Google's server when I go live (will they complain?). Or should I use a different outgoing mail server.
You can surely use your Gmail Id for mail configuration however avoid to use your personal one instead create a specific id for your app and use it.
Hello Ajay

I am making a lot of progress. But this HTML that I uploaded to your CDN doesn't get past the 'App42.initialize("****","****");' statement in the
'verifyFunction()' function which is executed at 'onload' event.

I know my keys are correct.

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    <title>Verify Email Addr</title>
    <link href="../css/create_user_style.css" rel="stylesheet" type="text/css">
    <link href="../css/jqueryAlert.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="../App42-all-2.6.min.js"></script>
    <script type="text/javascript" src="../jqueryAlert.js"></script>
    <script>
    function verifyFunction()
    {   
        $('#myResults').html('INITIALIZING!');
        App42.initialize("****","****");
        $('#myResults').html('WILL UPDATE!');
        updateJSONDocument();
    }
      
    function updateJSONDocument()
    {
        $('#myResults').html('UPDATING!');
    }
    </script>
  </head>
  <body onload="verifyFunction()"><br>
    <div style="text-align: center;" id="myResults"> THIS TEXT WILL CHANGE </div>
  </body>
</html>
Dan, You have to upload all your respective files js/css on CDN too and put the path in link and script tag. Currently it is trying to do a relative loading using .. operator and file will not get loaded in that case. You can use http://cdn.shephertz.com/repository/files/c4de4b86c04a553cd5910dd8aff8348ce694ae7e3e7d74b76dbe144591427a30/8400411558fe9f2c38bd0d4db012314cc0189f03/App42-all-2.7.js url for loading App42 JS file. Upload other JS and CSS file  too and it will work.
I uploaded:
create_user_style.css,
jqueryAlert.css,
jqueryAlert.js

but I selected the 'TXT' item from the dropdown list of file types to upload. Is that correct?

I also added the path to 'App42-all-2.7.js' that you just gave me, plus the respective CDN paths of the files I just uploaded to the HTML file. I hope this works.
well I got it working, kind of...

But this works:
        var storage = new App42Storage();
        var dbName = "TEST";  
        var collectionName = "TOTMPsubscriptions";
        var docId = getUrlVars()["docId"];
        var json = "{\"VERIFIED\":\"TRUE\"}";

        storage.updateDocumentByDocId(dbName, collectionName, docId, json,....

But this doesn't:

         storage.addOrUpdateKeys(dbName, collectionName, docId, json,...
Hello,
It looks like there is an issue with 2.7 js of SDK. Kindly find the latest version of App42 JS sdk from the below link and let us know if it helps.
 
http://cdn.shephertz.com/repository/files/4b65291e77f0779c41c51df028768c3015af7380271d068270a531c594b15706/97e579d58920faba5bb6636d74ae5a9699a0c278/JSFILE.js
 
Thanks
That URL only downloads one file: JSFILE.js
Is that correct?
Also I am using App42_Unity3D_SDK_2.8, not 2.7
I thought this is for JS since you were coding in HTML 5. Since JS file was having issue in addORUpdateKeys method so we updated that and passed you the same.
Can you please let me know what is the error you are getting while calling this method in Unity?
I am making that addORUpdateKeys call from within the HTML/JS file that I unploaded to your CDN. So I should not need any new files since it is a problem on the server.

Am I corrrect?
File that is hosted earlier is 2.7 and has this issue. New file is published to fix it and need to be uploaded again. Problem was in JS SDK which runs inside browser so you need to change the path of App42 JS SDK with new one in script tag. I have renamed the file JSFile.js (name looks stupid btw) with App42-all-2.8.js and you can use this one in your HTML file instead of 2.7 JS url. http://cdn.shephertz.com/repository/files/f840228ccb231e3b29fefe2c1a23ccc4f10852cb60bc5753b4e8e3a35d1905cd/d7c347bbf214b8381ca098f6d4ed77cb83bf7561/App42-all-2.8.js


Let me know if it helps.

Ajay
Got it. Thanks Ajay.
It WORKS! Thanks again Ajay.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...