1
0
mirror of https://dev.s-ul.net/Galexion/MaiMaiDXNet.git synced 2024-11-28 01:30:48 +01:00
MaiMaiDXNet/routes/api.js

34 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');
router.post('/getExtId/', function (req, res, next) {
db.all('SELECT * FROM sega_card', (err, rows) => {
if (err) {
console.error(err);
// Return a Failed Message.
res.status(500).json({ error: err.message, status: "Failed" });
} else {
// Make the Request easier to get to.
var request = req.body;
var mUser = undefined // Leave the Matched User undefined until the user is found.
for (user of rows) { // For Each User in Rows
if (request.input === user.luid) { // If the Access Code for the card is in the system,
mUser = user; // set the Matched User Variable to the User, and break the for Loop.
break
}
}
// Return a Response with the whole identifiable user data. the EXT_ID will be used later to identify images and other things and match them to the user's profile.
res.status(200).json({ data: mUser, status: "Complete" });
}
});
});
router.post('/getUserData/', function (req,res,next) {
})
module.exports = router;