events.js 562 Bytes
var express = require('express');
var router = express.Router();
var gcal = require('google-calendar');

router.post('/', function(req, res, next) {
    var accessToken = req.body.token;
    var id = req.body.id;
    gcal(accessToken).events.list(id,{maxResult:1},function(err,data){
        if(err) return console.log(err);
        else {
            console.log(data.items[0].start);
            res.render("events",{id:id,calendars:data.items});
            }
      });  
});


module.exports = router;

//db에서 calendar id에 해당하는 이벤트 출력