Skip to content
Permalink
Browse files
Done all tasks for week 2
  • Loading branch information
mitroio committed Oct 16, 2018
1 parent 316212b commit b3f6aa542e8c8795be2e45b2a3ea6313a1c396f4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
@@ -0,0 +1,2 @@
{
}
@@ -0,0 +1 @@
{ "parserOptions": { "ecmaVersion": 6 } }
Binary file not shown.
@@ -34,7 +34,7 @@ const db = new sqlite3.Database('./bookshop.db', (err) => {
})*/

app.get('/', async(req, res) => {
let sql = 'SELECT id, title FROM books;'
let sql = 'SELECT id, title, description, year FROM books;'
// --------
let querystring = ''
console.log(req.query.q)
@@ -50,7 +50,7 @@ app.get('/', async(req, res) => {
db.all(sql, (err, data) => {
if(err) console.error(err.message)
console.log(data)
res.render('newindex', {books: data, query: querystring})
res.render('newindex', {books: data, query: querystring || ' '})
})
})

@@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint index.js"
},
"author": "",
"license": "ISC",

0 comments on commit b3f6aa5

Please sign in to comment.