为什么Express App以这种方式构建? [英] Why is the Express App structured in this manner?

查看:75
本文介绍了为什么Express App以这种方式构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用于空白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


感谢您的理解。



祝您好运,


Fletch 


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, 

Fletch 


这篇关于为什么Express App以这种方式构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆