2013-05-28 22 views
0

我一直在使用流星兩個星期,我想添加功能發送用戶帳戶一旦創建電子郵件。我看了幾個關於Accounts.onCreateUser()函數的教程。這是下面的代碼。Meteor Accounts.createUser引發內部服務器錯誤?

if(Meteor.isClient{ 
    ....some code here..... 
    Accounts.createUser({ 
     ..... Insert some options ...... 
    }, function(error){ 
     ..... some More code here ...... 
    }); 
} 

if(Meteor.isServer){ 
    Accounts.onCreate(function(options, user){ 
     ...... Do the required ....... 
    }); 
} 

它似乎是根據我一直在使用的幾個教程。

我測試了代碼,但該帳戶的onCreate總是返回'內部服務器錯誤',我無法找到它的原因。這是我認爲該窗體的Accounts.onCreate()回調的方式嗎?

還有一個調試功能,如果是的話,我可以進一步跟蹤代碼?

感謝

回答

1

您的代碼表示onCreate,而不是onCreateUser。也許這是一個錯字?同時確保它正在返回user文檔。您可以隨時添加console.log以測試是否正在使用正確的參數調用函數。

相關問題