generator-express icon indicating copy to clipboard operation
generator-express copied to clipboard

three blank lines generated in the head of app.js

Open huahuayu opened this issue 4 years ago • 0 comments

hi, I just try to generate express project, and I found three blank lines generated in app.js (in mvc model), I think it can be removed

 
 
 
const express = require('express');
const config = require('./config/config');
const db = require('./app/models');

const app = express();

module.exports = require('./config/express')(app, config);

db.sequelize
  .sync()
  .then(() => {
    if (!module.parent) {
      app.listen(config.port, () => {
        console.log('Express server listening on port ' + config.port);
      });
    }
  }).catch((e) => {
    throw new Error(e);
  });

I am new to node, I rare see blew usage of module.exports , I have searched in google but didn't find this usage, can you please explain that?

module.exports = require('./config/express')(app, config);

is it as same as

module.exports = {
 app,
config,
}

but why require('./config/express') in there?

huahuayu avatar May 26 '20 11:05 huahuayu