statistics lol
This commit is contained in:
parent
85becbb8a4
commit
26be5bf757
|
@ -1,5 +1,11 @@
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
|
import db from "../../lib/sql";
|
||||||
|
|
||||||
|
const queries = {
|
||||||
|
statistic: "select count(*) as sum from `pastes`"
|
||||||
|
};
|
||||||
|
|
||||||
export default express.Router()
|
export default express.Router()
|
||||||
.get("/", (req, res) => {
|
.get("/", (req, res) => {
|
||||||
res.render("about");
|
res.render("about");
|
||||||
|
@ -11,5 +17,8 @@ export default express.Router()
|
||||||
res.render("contact");
|
res.render("contact");
|
||||||
})
|
})
|
||||||
.get("/statistics", (req, res) => {
|
.get("/statistics", (req, res) => {
|
||||||
res.render("statistics");
|
db.exec(queries.statistic).then(rows => {
|
||||||
|
const r = rows[0];
|
||||||
|
res.render("statistics", { pastes: r.sum });
|
||||||
|
}).catch(err => console.log(err));
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user