在ember-cli上设置UserApp.io

时间:2015-05-01 18:53:28

标签: ember.js configuration ember-cli userapp

这可能看似微不足道,但我没有成功实现这一点。我已成功使用UserApp.io进行用户/身份验证管理。我最近使用ember-cli创建了一个ember应用程序,但我无法让两者一起工作,尽管UserApp.io支持ember。这里有说明(与没有cli的ember集成)。

https://github.com/userapp-io/userapp-ember

这是一个片段:

在index.html中包含UserApp JavaScript库和此Ember模块。请务必在app.js文件之前添加它们。

SELECT
    forums.*,
    counts.thread_count,
    counts.post_count,
    threads.*,           -- last thread
    users.*              -- user of last thread
FROM forums
LEFT JOIN (
    SELECT 
        forums.forum_id,
        COUNT(DISTINCT threads.thread_id) AS thread_count,
        COUNT(DISTINCT posts.post_id) AS post_count
    FROM forums 
    LEFT JOIN threads ON threads.forum_id = forums.forum_id
    LEFT JOIN posts ON posts.thread_id = threads.thread_id
    GROUP BY forums.forum_id
) counts ON counts.forum_id = forums.forum_id
LEFT JOIN (
    SELECT
        forums.forum_id,
        threads.thread_id,
    FROM forums
    JOIN threads ON forums.forum_id = threads.forum_id
    AND threads.thread_date = 
        (SELECT MAX(threads.thread_date) AS last_topic
            FROM threads 
            WHERE forums.forum_id = threads.forum_id)
) last_thread ON last_thread.forum_id = forums.forum_id
LEFT JOIN threads ON threads.thread_id = last_thread.thread_id
LEFT JOIN users ON users.user_id = threads.user_id

(您也可以使用bower安装模块:<script src="https://app.userapp.io/js/userapp.client.js"></script> <script src="https://app.userapp.io/js/ember-userapp.js"></script>

启动模块

将app.js中的$ bower install userapp-ember上方的代码添加到您的应用ID。

App = Ember.Application.create();

因为我使用的是ember-cli,所以我在initializers文件夹中创建了一个名为Ember.Application.initializer({ name: 'userapp', initialize: function(container, application) { Ember.UserApp.setup(application, { appId: 'YOUR-USERAPP-APP-ID' }); } }); 的文件,其中包含以下代码:

userapp.js

当我运行我的应用时,我收到以下错误:

import Ember from 'ember';

export default {
    name: 'userapp',
    initialize: function(container, application) {
        Ember.UserApp.setup(application, { 
            appId: 'USERAPP-ID-INSERTED-HERE',
            loginRoute: 'login',
            indexRoute: 'index',
            heartbeatInterval: 20000,
            usernameIsEmail: false
        });
    }
};

我觉得这是简单/愚蠢的事情,但对于我的生活,我无法想出这一点。

0 个答案:

没有答案