mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
redo of entire app
This commit is contained in:
1 parent
7dee4879a7
commit
093dd7ea9e
45 files changed
+686
-5659
No files matched your search
@@ -0,0 +1,18 @@
|
||||
const { query } = require('../lib/db');
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
async function seedDb() {
|
||||
try {
|
||||
const hashedPassword = bcrypt.hashSync('admin', 10);
|
||||
await query(
|
||||
'INSERT OR IGNORE INTO users (username, password, role) VALUES (?, ?, ?)',
|
||||
['admin', hashedPassword, 'admin']
|
||||
);
|
||||
|
||||
console.log('Database seeded successfully.');
|
||||
} catch (err) {
|
||||
console.error('Error seeding database:', err);
|
||||
}
|
||||
}
|
||||
|
||||
seedDb();
|
||||
Reference in new issue
Block a user