-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadmins.js
More file actions
27 lines (21 loc) · 741 Bytes
/
admins.js
File metadata and controls
27 lines (21 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const adminUser = require('./models/adminUser');
const mongoose = require('mongoose');
var adminuser = new adminUser({
email: '*************',
password: '**************',
role: 'admin'
});
const email = "************";
const password = "************";
const role = "restricted";
const dbURI = '*******************';
mongoose.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex:true })
.then(async (result) => {
console.log('connection made!!');
adminuser.save().then(function(){
console.log("admin created suceesfully");
});
const adminuser_ = await adminUser.create({ email, password, role });
console.log(adminuser_);
})
.catch((err) => console.log(err));