notices.js 398 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
const express = require('express');
const Notice = require('../schemas/notice');

const router = express.Router();

router.get('/', function (req, res, next) {
    Notice.find({}).sort({ post_date: -1 })
        .then((notices) => {
            res.json(notices);
        })
        .catch((err) => {
            console.error(err);
Ha YeaJin's avatar
Ha YeaJin committed
13

14
15
16
17
18
            next(err);
        });
});

module.exports = router;