This commit is contained in:
omkieit 2024-11-05 17:05:00 +05:30
parent 6b0be193a5
commit 9f15c3ff1a
1 changed files with 10 additions and 10 deletions

View File

@ -9,8 +9,8 @@ import propertyRouter from "./routes/property.js";
import mysqlRouter from "./routes/mysqlproperty.js"; import mysqlRouter from "./routes/mysqlproperty.js";
import adminRouter from "./routes/admin.js" import adminRouter from "./routes/admin.js"
import dotenv from "dotenv"; import dotenv from "dotenv";
import bcrypt from "bcryptjs"; // import bcrypt from "bcryptjs";
import adminModal from "./models/admin.js"; // import adminModal from "./models/admin.js";
const app = express(); const app = express();
dotenv.config(); dotenv.config();
@ -70,13 +70,13 @@ dbConnectionPromise
}); });
const createAdminUser = async () => { // const createAdminUser = async () => {
const hashedPassword = await bcrypt.hash("Uer$99#KKma-hi19", 10); // const hashedPassword = await bcrypt.hash("Uer$99#KKma-hi19", 10);
const admin = new adminModal({ username: "admin", password: hashedPassword }); // const admin = new adminModal({ username: "admin", password: hashedPassword });
await admin.save(); // await admin.save();
console.log("Admin user created.", admin); // console.log("Admin user created.", admin);
mongoose.disconnect(); // mongoose.disconnect();
}; // };
createAdminUser(); // createAdminUser();