server/router/info.js
Artem Anufrij cff48aaada
All checks were successful
continuous-integration/drone Build is passing
move
2023-02-08 12:30:56 +01:00

34 lines
1017 B
JavaScript

console.log("router/info INIT");
var express = require("express");
var router = new express.Router();
var database = require("../services/database");
let info = {}
info.stats = {}
router
.route("")
.get((req, res) => {
database.artist_count((q, c) => {
info.stats.artists = c;
database.album_count((q, c) => {
info.stats.albums = c;
database.track_count((q, c) => {
info.stats.tracks = c;
database.box_count((q, c) => {
info.stats.boxes = c;
database.video_count((q, c) => {
info.stats.videos = c;
database.users_count((q, c) => {
info.stats.users = c;
res.json(info);
});
});
});
});
});
});
});
module.exports = router;