Menu
NodeCG LogoNodeCG LogoNodeCGv1.7.0DocsBlog
GitHub
๐ŸŒœ
๐ŸŒž
NodeCG LogoNodeCG LogoNodeCG
  • v1.7.0
  • Docs
  • Blog
  • GitHub
  • Quick Start
    • NodeCG
    • Installing
    • Creating Bundles
  • Guides
    • Concepts and Terminology
    • Manifest
    • Configuration
    • Node Dependencies
    • Bundle Configuration
    • Assets
    • Sounds
    • Replicant Validation
    • Performance
    • Making Dashboard Dialogs
    • Portable NodeCG
  • Advanced
    • Mount folders as endpoints
    • Security & Authentication
    • Testing Graphics
    • Custom Routes
    • Sentry.io
  • Using Frameworks
    • Bundlers
    • TypeScript
    • vue.js
    • p5.js
  • Migrating
    • 0.7 โ†’ 0.8
    • 0.8 โ†’ 0.9
    • 0.9 โ†’ 1.0
  • API Reference
    • NodeCG
    • Replicant
    • readReplicant
    • waitForReplicants
    • sendMessage
    • sendMessageToBundle
    • listenFor
    • unlisten
    • log()
    • Router
    • mount()
    • getDialog
    • getDialogDocument
    • getSocketIOServer()
    • findCue
    • playSound
    • stopAllSounds()
    • stopSound

Router

Extension Only

This can only be used in code which runs on the server.

Router

Creates a new express router.

See the express docs for full usage details.

Example#

Defining a simple GET route:

module.exports = function (nodecg) {
const app = nodecg.Router();
app.get('/my-bundle/example', (req, res) => {
res.send('custom route confirmed');
});
nodecg.mount(app);
}
Edit this page
Last updated on 1/9/2021 by Ewan Lyon
Previous
ยซ log()
Next
mount() ยป
  • Example

Docs

  • What is NodeCG
  • Quick Start

Community

  • Discord

Social

  • Blog
  • GitHub
  • Twitter
Copyright (c) 2020 Alex Van Camp, Matthew McNamara, and contributors