Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

three blank lines generated in the head of app.js #248

@huahuayu

Description

@huahuayu

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions