为什么Express App以这种方式构建? [英] Why is the Express App structured in this manner?
问题描述
在用于空白Node.js Express应用程序的Microsoft Visual Studio 2015模板中,代码导出app并且启动文件为bin \而不是通常的app.js作为启动文件www包含:
#!/ usr / bin / env node
var debug = require('debug')('ExpressApp1');
var app = require('../ app');
app.set('port',process.env.PORT || 3000);
var server = app.listen(app.get('port'),function(){
debug('Express服务器侦听端口'+ server.address()。port);
});
使用此模式的目的是什么? 它提供什么?
谢谢。
嗨K.Kong,
作为这个论坛对于Visual Studio IDE,您的问题与Node.js更相关,您可以在此处获得专业答案:
https://github.com/nodejs/node/issues
感谢您的理解。
祝您好运,
In the Microsoft Visual Studio 2015 template for a blank Node.js Express application, instead of having the usual app.js as the start file, the code exports app and the start up file is bin\www which contains:
#!/usr/bin/env node var debug = require('debug')('ExpressApp1'); var app = require('../app'); app.set('port', process.env.PORT || 3000); var server = app.listen(app.get('port'), function() { debug('Express server listening on port ' + server.address().port); });
What is the purpose of using this pattern? What does it offer?
Thanks.
Hi K.Kong,
As this forum is for Visual Studio IDE, your issue is more related to Node.js, you could get a professional answer here:
https://github.com/nodejs/node/issues
Thanks for your understandings.
Best regards,
这篇关于为什么Express App以这种方式构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!