getResultMine1.js 967 Bytes
const getCardId=require('./getCardId')
const puppeteer=require('puppeteer')
const request = require('request')
const cheerio=require('cheerio')
const mysql=require('mysql')
const fs=require('fs')
const ejs=require('ejs')

//result.ejs 렌더링 전 수행됨. 현재 덱 ID와 상대 직업을 가지고 상대의 점유율 상위 3개 덱과, 내 덱의 추천 멀리건 출력
//return : 렌더링 된 result.ejs
exports.GetResult=(req,res)=>{
    const opponentClass=req.session.opponentClass
    const deck=req.session.decks
    const Name=req.session.names
        try{
            fs.readFile('./views/ejs/score_result.ejs','utf-8',(err,data)=>{
                res.writeHead(200,{'Content-Type':'text/html'})
                res.end(ejs.render(data,{
                    MineClass:opponentClass || [],
                    decks: deck || [0,0,0],
                    Names: Name || ["", "", ""],
                }))
            })
        }finally{

        }
}