import * as express from "express";
import * as QRCode from "qrcode";


const router = express.Router();

router.use((req, res, next) => {
  if (!req.cookies || !req.cookies.uid) {
    res.status(404);
    res.send();
  } else {
    next();
  }
});

router.get("/", (req, res, next) => {
  QRCode.toDataURL(req.cookies.uid, (err, url) => {
    res.render("export", {title: "Export", uid: req.cookies.uid, dataurl: url});
  });
});
export = router;
