Skip to content

Instantly share code, notes, and snippets.

@HyunsDev
Created December 19, 2020 09:39
Show Gist options
  • Save HyunsDev/bee434bf2f905533db2e33f038770d1e to your computer and use it in GitHub Desktop.
Save HyunsDev/bee434bf2f905533db2e33f038770d1e to your computer and use it in GitHub Desktop.
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