Jordi
Jordi

Reputation: 331

SailsJS where to define admin user if not exists on deployment

Given I'm developing an API with authentication under SailsJS where do you think I must/should insert the code to create or initialize the admin user if not exists?

Thanks!!

Upvotes: 0

Views: 313

Answers (1)

Dejan Kubaša
Dejan Kubaša

Reputation: 191

If u need admin user for development, u can use bootstrap for that.

await User.create({ emailAddress: '[email protected]', fullName: 'Ryan Dahl', isSuperAdmin: true, password: await sails.helpers.passwords.hashPassword('abc123') }).fetch()

This is what Mike McNeil recommend in example.

Upvotes: 2

Related Questions