{"size": 920, "ext": "js", "max_stars_repo_path": "routes/login.js", "max_stars_repo_name": "NewUserFound/labtwo45", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "routes/login.js", "max_issues_repo_name": "NewUserFound/labtwo45", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routes/login.js", "max_forks_repo_name": "NewUserFound/labtwo45", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.6666666667, "max_line_length": 101, "alphanum_fraction": 0.6336956522}
var express = require('express');
var router = express.Router();
var fs = require('fs');
var account = require('../model/accountstruct.js');

let accountData = fs.readFileSync('./account.json');
let siteAccounts = JSON.parse(accountData);
const accountString = JSON.stringify(siteAccounts)

/* Create Account */
router.get('/', function(req, res, next) {
    //Using the data model boxer from boxerstructure.js
    account.email = req.body.email;
    account.password = req.body.password;   
    
    for(var x = 0; x < accountString.length; x++){
        if(account.email == accountString[x].email & account.password == accountString[x].password ){
            console.log("login is successful");
            x = accountString.length;
        } else{
            console.log("login was not succesful");
            x = accountString.length;
        }
    }
    
    res.render('index');
  });

module.exports = router;
