404.js 430 B

12345678910111213141516171819
  1. 'use strict';
  2. require('../models/db');
  3. var config = require('config');
  4. module.exports = (req, res, next) => {
  5. var err = new Error('Not Found');
  6. if (req.accepts('text/html')) {
  7. res.status(404).render('not_found', {
  8. title: 'Page Not Found.'
  9. });
  10. } else if (req.accepts('application/json')) {
  11. res.status(404).json({
  12. "error": "not_found"
  13. });
  14. } else {
  15. res.status(404).send("Not Found.");
  16. }
  17. }