mirror of
https://github.com/wassname/talk.git
synced 2026-07-02 05:00:05 +08:00
21 lines
648 B
JavaScript
21 lines
648 B
JavaScript
const express = require('express');
|
|
const debug = require('debug')('talk:routes:plugins');
|
|
const plugins = require('../services/plugins');
|
|
const staticTemplate = require('../middleware/staticTemplate');
|
|
const nonce = require('../middleware/nonce');
|
|
|
|
const router = express.Router();
|
|
|
|
// TODO: re-add CSP once we've resolved issues with dynamic webpack loading.
|
|
router.use(staticTemplate, nonce);
|
|
|
|
// Inject server route plugins.
|
|
plugins.get('server', 'router').forEach(plugin => {
|
|
debug(`added plugin '${plugin.plugin.name}'`);
|
|
|
|
// Pass the root router to the plugin to mount it's routes.
|
|
plugin.router(router);
|
|
});
|
|
|
|
module.exports = router;
|