Issues (17)

routes/week.js (2 issues)

Severity
1
var express = require('express');
2
var router = express.Router();
3
const sqlite3 = require('sqlite3').verbose();
0 ignored issues
show
The constant sqlite3 seems to be never used. Consider removing it.
Loading history...
4
// const db = new sqlite3.Database('./db/texts.sqlite');
5
const db = require("../db/database.js");
6
7
router.get('/', function(req, res, next) {
0 ignored issues
show
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
8
    const data = {
9
        data: {
10
            msg:  "No week given"
11
        }
12
    };
13
14
    res.json(data);
15
});
16
17
router.get("/:msg", (req, res) => {
18
    db.each("SELECT week, text FROM reports WHERE week = " + req.params.msg, function(err, row) {
19
        // console.log(row.week + ": " + row.text);
20
        const data = {
21
            data: {
22
                week: row.week,
23
                text: row.text
24
            }
25
        };
26
27
        res.json(data);
28
    });
29
30
31
});
32
33
module.exports = router;
34