1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 'use strict';
- const express = require('express');
- const router = express.Router();
- const notFoundMiddleware = require('../middlewares/not-found');
- /**
- * Home Controller
- */
- const HomeController = require('../controllers/home');
- function init(app, passport) {
- /**
- * Set up routes
- */
- const contactRoutes = require('./contact')(router);
- const listRoutes = require('./list')(router);
- const pagesRoutes = require('./pages')(router);
- const profileRoutes = require('./profile')(router);
- const uploadRoutes = require('./upload')(router);
- const userRoutes = require('./user')(router, passport);
- const watchRoutes = require('./watch')(router);
- const filmRoutes = require('./film')(router);
- /**
- * Mount routes
- */
- /** GET / - Home */
- app.get('/', HomeController.index);
- app.use('/', contactRoutes);
- app.use('/', listRoutes);
- app.use('/', pagesRoutes);
- app.use('/', profileRoutes);
- app.use('/', uploadRoutes);
- app.use('/', userRoutes);
- app.use('/', watchRoutes);
- app.use('/', filmRoutes);
- /**
- * Error handling middleware
- */
- app.use(notFoundMiddleware);
- }
- module.exports = { init };
|