I need to be able to create a user in the server directory that can be login to and only is created the fist time the sever starts.
Assuming you have accounts-password
added then you can:
Meteor.startup(function(){
if(!Meteor.users.find().count()){
Accounts.createUser({
username: 'Bob123',
password: '123Bob'
})
}
});
1 Like
Example:
Meteor.startup(() => {
if (!Meteor.users.findOne({username: 'admin'})) {
let id = Accounts.createUser({
username: 'admin',
email: 'admin',
password: 'admin'
})
}
}
(server/admin-user.es6.js)
EDIT: haha, both of us probably copy-pasting it out of the same one project we’re currently working on
1 Like