Created
December 19, 2020 09:39
-
-
Save HyunsDev/bee434bf2f905533db2e33f038770d1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.post('/api/read', function (req, res, next) { | |
var connection = mysql.createConnection(dbconfig); | |
connection.connect(); | |
connection.query("SELECT id, line, created FROM dayline2.lines ORDER BY id DESC limit 1000;", function (error, results, fields) { | |
if (error) { | |
console.log(error); | |
res.send({ | |
status: "ERR", | |
reason: error | |
}) | |
} else { | |
res.send({ | |
status: "OK", | |
data : results | |
}) | |
} | |
} | |
); | |
connection.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment