login.js 522 Bytes
const express = require("express");
const router = express.Router();

const { getPeed, getSubjects, login } = require("../libs/E_Campus.js");

router.post("/", async (req, res) => {
  console.log(`listened /login ${req.body.id} ${req.body.pw}`);
  const page = await login(req.body.id, req.body.pw);
  if (page) {
    try {
      const peed = await getPeed(page);
      res.send(peed);
    } catch (e) {
      console.log(e);
      res.send("error");
    }
  } else res.send("login failed");
});

module.exports = router;