mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
18 lines
424 B
JavaScript
18 lines
424 B
JavaScript
const Database = require('better-sqlite3');
|
|
|
|
// Initialize the database connection
|
|
const db = new Database('./clue_hunt.db');
|
|
|
|
// Helper function to run queries
|
|
function query(sql, params) {
|
|
try {
|
|
const stmt = db.prepare(sql);
|
|
return params ? stmt.all(params) : stmt.all();
|
|
} catch (err) {
|
|
console.error('Error executing query:', err);
|
|
throw err;
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = { query }; |