getdeckname2.js 786 Bytes
const puppeteer=require('puppeteer')
const cheerio=require('cheerio')
const fs=require('fs')
const ejs=require('ejs')

//prob_result.ejs를 띄우기 위한 변수들 넘겨주기
exports.getDeckname=(req,res)=>{
    const deckname=req.session.deckname
    const winRate=req.session.winRate
    const mulName=req.session.mulName
    const mulwinRate=req.session.mulwinRate
    try{
        fs.readFile('./views/ejs/prob_result.ejs','utf-8',(err,data)=>{
            res.writeHead(200,{'Content-Type':'text/html'})
            res.end(ejs.render(data,{
                deckName : deckname || [],
                winRate:winRate || [0],
                mulNames:mulName || ["", "", "", ""],
                mulwinRate:mulwinRate || [0, 0, 0, 0]
            }))
        })
    }finally{}
}