代码之家  ›  专栏  ›  技术社区  ›  Kirill

如何设置web应用程序以与解析服务器(JavaScript)通信

  •  1
  • Kirill  · 技术社区  · 8 年前

    我有一个在AWS上运行的解析服务器,我想知道如何将一个对象保存到它。我不知道如何连接到我的javascript文件中的解析服务器。。。

    我是否做过类似的事情:

    var Parse=require('Parse');

    Parse.initialize(“YOUR_APP_ID”);

    作语法分析服务器URL=' http://mypath '

    另外,如何在js文件中包含Parse SDK?

    1 回复  |  直到 8 年前
        1
  •  4
  •   Kirill    8 年前

    成功了!

    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Untitled Document</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="https://npmcdn.com/parse/dist/parse.min.js"></script>
    <script>
        Parse.initialize("518e0dbca14e73748f81e550e12deea515ff959e");
        Parse.serverURL = 'http://ec2-35-165-199-91.us-west-2.compute.amazonaws.com:80/parse';
        var GameScore = Parse.Object.extend("GameScore");
        var gameScore = new GameScore();
        gameScore.save({playerName: "Kir"}).then(function(object) {
            alert("yay! it worked");
        });
    </script>
    </head>
    <body>
    </body>
    </html>