user3142695
user3142695

Reputation: 17322

Meteor: Call server-side method by client

I'm creating a new user with Accounts.createUser() on client side in a Admin-Frontend. This works, but after creating the user, there is a auto-login, which is very logic, as the input has be done on client side. But I want to create new users by an admin-account on frontend.

So I thought about creating a server-method, calling from client. But that doesn't work:

server.js

Meteor.methods({
    'createUserByAdmin': function(){
        console.log("Hello world");
        // Create user here
    }
});

client.js

Template.users.events({
    'submit form': function(event) {
        event.preventDefault();
        Meteor.call('createUserByAdmin');
    }
});

Now I would expect by submiting the form there should be "Hello world" on the console. But I don't get anything.

Upvotes: 2

Views: 1416

Answers (1)

user3848987
user3848987

Reputation: 1657

You have to look at the server console.

Upvotes: 4

Related Questions