test/db.js

20 lines
475 B
JavaScript

const path = require('path');
const sqlite3 = require('sqlite3').verbose();
const dbPath = path.join(__dirname, 'recipes.db');
const db = new sqlite3.Database(dbPath);
db.serialize(() => {
db.run(
`CREATE TABLE IF NOT EXISTS recipes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
ingredients TEXT NOT NULL,
instructions TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
)`
);
});
module.exports = db;