# Exporting Express App to a Module
The following pattern is useful when you have a module that requires the main app express variable:
// app.js file
const express = require('express');
const bodyParser = require('body-parser');
const morgan = require('morgan');
const app = module.exports = express();
// someModule.js
const app = require('../path/to/app.js');
someFunction(app);
Posted on: Wed, 03 Oct 2018 15:22:11 GMT