index.js 633 Bytes
const express = require('express');
const router = express.Router();
const models = require('../models/index');

router.get('/', async (req, res, next) => {
    try {
        if (!req.isAuthenticated()) {
            return res.render('index', {
                    title: '홈',
                    user: null,
                    posts: [],
                }
            );
        }

        return res.render('index', {
                title: '홈',
                user: req.user,
            }
        );
    } catch (e) {
        console.error(e);
        next(e);
    }
});

module.exports = router;