aboutsummaryrefslogtreecommitdiffstats
path: root/db.js
diff options
context:
space:
mode:
authorpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
committerpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
commit55a4f1fc869e41aca748c63d3018f0448b1606e0 (patch)
treed132d1d01772b6d53faee3e63c534dea5706b78a /db.js
downloadcrud-55a4f1fc869e41aca748c63d3018f0448b1606e0.tar.gz
first commit
Diffstat (limited to '')
-rw-r--r--db.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/db.js b/db.js
new file mode 100644
index 0000000..1ca5195
--- /dev/null
+++ b/db.js
@@ -0,0 +1,9 @@
+const sqlite3 = require('sqlite3').verbose();
+const db = new sqlite3.Database('./app.db');
+db.serialize(() => {
+ db.run(`CREATE TABLE IF NOT EXISTS users (
+ id INTEGER PRIMARY KEY, username TEXT UNIQUE, password TEXT)`);
+ db.run(`CREATE TABLE IF NOT EXISTS items (
+ id INTEGER PRIMARY KEY, user_id INTEGER, title TEXT, content TEXT)`);
+});
+module.exports = db;