-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.js
59 lines (40 loc) · 1.2 KB
/
db.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const sqlite3 = require('sqlite3').verbose()
const db = new sqlite3.Database('./ws.db')
db.serialize(function() {
db.run(`
CREATE TABLE IF NOT EXISTS ideas(
id INTEGER PRIMARY KEY AUTOINCREMENT,
image TEXT,
title TEXT,
category TEXT,
description TEXT,
link TEXT
);
`)
//const query = `
// INSERT INTO ideas(
// image,
// title,
// category,
// description,
// link
// ) VALUES (?,?,?,?,?);
//`
//const values = [
// "https://image.flaticon.com/icons/svg/2729/2729007.svg",
// "Cursos de Programação",
// "Estudo",
// "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit error ipsam facilis possimus numquam illo",
// "https://rocketseat.com.br"
//]
//db.run(query, values, function(err) {
// if(err) return console.log(err)
//
// console.log(this)
//})
//db.run(`DELETE FROM ideas WHERE id=?`,[1],function(err){
// if (err) return console.log(err)
// console.log("deletei",this)
//})
})
module.exports = db