getdeckname2.js 725 Bytes
const puppeteer=require('puppeteer')
const cheerio=require('cheerio')
const fs=require('fs')
const ejs=require('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{}
}