Thursday, 21 November 2019

What's the best way to add a default admin user in Node.js/MongoDB app?

So I have an application developed in Nodejs and is using the Mongodb/Mongoose database. Beside the application there is an admin panel where administrators can manage all the data added from regular users.

in the users schema I have following:

role: {
        type: String,
        default: "user",
        enum: ["user", "admin"]
    },

My questions is what's the best/secure way to add one or two admin users where they can sign in using the login form?



from What's the best way to add a default admin user in Node.js/MongoDB app?

No comments:

Post a Comment