mirror of
https://dev.s-ul.net/Galexion/MaiMaiDXNet.git
synced 2024-11-28 00:20:50 +01:00
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var fetch = require('cross-fetch');
|
|
const sqlite3 = require('sqlite3').verbose();
|
|
|
|
let db = new sqlite3.Database('A:\\db.sqlite');
|
|
/* GET home page. */
|
|
var title = 'Webapp Mission Test'
|
|
router.get('/', function (req, res, next) {
|
|
db.all('SELECT * FROM sega_card', (err, rows) => {
|
|
if (err) {
|
|
console.error(err);
|
|
res.render('error', {error: err});
|
|
} else {
|
|
console.log(rows);
|
|
console.log(`There are Currently ${rows.length} Users Registered.`); // this check could probably be changed into an API
|
|
var params = {
|
|
totalUsers: rows.length
|
|
}
|
|
res.render('index', {title: title, params: params});
|
|
}
|
|
});
|
|
});
|
|
|
|
router.get('/user', function (req, res, next) {
|
|
db.all('SELECT * FROM sega_card', (err, rows) => {
|
|
if (err) {
|
|
console.error(err);
|
|
res.render('error', {error: err});
|
|
} else {
|
|
console.log(rows);
|
|
console.log(`There are Currently ${rows.length} Users Registered.`); // this check could probably be changed into an API
|
|
var params = {
|
|
totalUsers: rows.length
|
|
}
|
|
res.render('user', {title: title, params: params});
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
module.exports = router; |