diff --git a/api/stats.js b/api/stats.js new file mode 100644 index 0000000..6984992 --- /dev/null +++ b/api/stats.js @@ -0,0 +1,25 @@ +import express from 'express' +import * as db from './db.js' +import {AVATAR, SQL_ORDER} from "./db.js"; + +const api = express.Router(); + +api.get('/char_stats/:batch', async (req, res, next) => { + try { + const stats = await db.get_stats(); + + stats.empires = { "TR": 0, "NC": 0, "VS": 0 } + + var batch = req.params.batch; + + const avatars = await db.get_character_batch_for_stats(batch, AVATAR.ID, SQL_ORDER.ASCENDING); + + res.status(200).json({ players: avatars }); + + } catch (e) { + console.log(e); + res.status(500).json({ message: 'error' }); + } +}); + +export default api; \ No newline at end of file