app.router

The application’s in-built instance of router. This is created lazily, on first access.

const express = require('express');
const app = express();
const router = app.router;

router.get('/', (req, res) => {
  res.send('hello world');
});

app.listen(3000);

You can add middleware and HTTP method routes to the router just like an application.

For more information, see Router.