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) { db.all('SELECT * FROM maimai2_user_detail', (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.aime_card_id) { // 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" }); } }); }) module.exports = router;