app.listen(3000)与app是不一样的
前者是server代码如下
Server {
domain: null,
_events:
{ request:
{ [Function]
domain: undefined,
_events: [Object],
_maxListeners: undefined,
setMaxListeners: [Function: setMaxListeners],
getMaxListeners: [Function: getMaxListeners],
emit: [Function: emit],
addListener: [Function: addListener],
on: [Function: addListener],
once: [Function: once],
removeListener: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
listeners: [Function: listeners],
listenerCount: [Function: listenerCount],
init: [Function: init],
defaultConfiguration: [Function: defaultConfiguration],
lazyrouter: [Function: lazyrouter],
handle: [Function: handle],
use: [Function: use],
route: [Function: route],
engine: [Function: engine],
param: [Function: param],
set: [Function: set],
path: [Function: path],
enabled: [Function: enabled],
disabled: [Function: disabled],
enable: [Function: enable],
disable: [Function: disable],
checkout: [Function],
connect: [Function],
copy: [Function],
delete: [Function],
get: [Function],
head: [Function],
lock: [Function],
'm-search': [Function],
merge: [Function],
mkactivity: [Function],
mkcalendar: [Function],
mkcol: [Function],
move: [Function],
notify: [Function],
options: [Function],
patch: [Function],
post: [Function],
propfind: [Function],
proppatch: [Function],
purge: [Function],
put: [Function],
report: [Function],
search: [Function],
subscribe: [Function],
trace: [Function],
unlock: [Function],
unsubscribe: [Function],
all: [Function: all],
del: [Function],
render: [Function: render],
listen: [Function: listen],
request: [Object],
response: [Object],
cache: {},
engines: {},
settings: [Object],
_eventsCount: ,
locals: [Object],
mountpath: '/',
_router: [Object] },
connection: [Function: connectionListener],
clientError: [Function] },
_eventsCount: ,
_maxListeners: undefined,
_connections: ,
_handle:
TCP {
_externalStream: {},
fd: ,
reading: false,
owner: [Circular],
onread: null,
onconnection: [Function: onconnection],
writeQueueSize: },
_usingSlaves: false,
_slaves: [],
_unref: false,
allowHalfOpen: true,
pauseOnConnect: false,
httpAllowHalfOpen: false,
timeout: ,
_pendingResponseData: ,
_connectionKey: '6::::3000' }
后者还没有实例化算是一个类:代码如下:
{ [Function]
domain: undefined,
_events: { mount: [Function: onmount] },
_maxListeners: undefined,
setMaxListeners: [Function: setMaxListeners],
getMaxListeners: [Function: getMaxListeners],
emit: [Function: emit],
addListener: [Function: addListener],
on: [Function: addListener],
once: [Function: once],
removeListener: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
listeners: [Function: listeners],
listenerCount: [Function: listenerCount],
init: [Function: init],
defaultConfiguration: [Function: defaultConfiguration],
lazyrouter: [Function: lazyrouter],
handle: [Function: handle],
use: [Function: use],
route: [Function: route],
engine: [Function: engine],
param: [Function: param],
set: [Function: set],
path: [Function: path],
enabled: [Function: enabled],
disabled: [Function: disabled],
enable: [Function: enable],
disable: [Function: disable],
checkout: [Function],
connect: [Function],
copy: [Function],
delete: [Function],
get: [Function],
head: [Function],
lock: [Function],
'm-search': [Function],
merge: [Function],
mkactivity: [Function],
mkcalendar: [Function],
mkcol: [Function],
move: [Function],
notify: [Function],
options: [Function],
patch: [Function],
post: [Function],
propfind: [Function],
proppatch: [Function],
purge: [Function],
put: [Function],
report: [Function],
search: [Function],
subscribe: [Function],
trace: [Function],
unlock: [Function],
unsubscribe: [Function],
all: [Function: all],
del: [Function],
render: [Function: render],
listen: [Function: listen],
request: IncomingMessage { app: [Circular] },
response: ServerResponse { app: [Circular] },
cache: {},
engines: {},
settings:
{ 'x-powered-by': true,
etag: 'weak',
'etag fn': [Function: wetag],
env: 'development',
'query parser': 'extended',
'query parser fn': [Function: parseExtendedQueryString],
'subdomain offset': ,
'trust proxy': false,
'trust proxy fn': [Function: trustNone],
view: [Function: View],
views: '/Users/Amanda/Downloads/aa/blog/views',
'jsonp callback name': 'callback' },
_eventsCount: ,
locals:
{ settings:
{ 'x-powered-by': true,
etag: 'weak',
'etag fn': [Function: wetag],
env: 'development',
'query parser': 'extended',
'query parser fn': [Function: parseExtendedQueryString],
'subdomain offset': ,
'trust proxy': false,
'trust proxy fn': [Function: trustNone],
view: [Function: View],
views: '/Users/Amanda/Downloads/aa/blog/views',
'jsonp callback name': 'callback' } },
mountpath: '/',
_router:
{ [Function: router]
params: {},
_params: [],
caseSensitive: false,
mergeParams: undefined,
strict: false,
stack: [ [Object], [Object], [Object] ] } }
另外app.createServer()此方法已经被废除;属于旧代码;websocket要监听服务器,监听实例化得app,即第一种server;
app.listen(3000)与app是不一样的的更多相关文章
- Express app.listen 函数了解
最近一直在学习如何用原生的 Node.js 来做一个网站.在写的同时也在学习 Express 源码. 一直觉得 Express 开启服务器的方法挺有趣的,就看了一下. 在 Express 运行的时候会 ...
- Android 一个app启动另一个app
最近,一个app启动另一个app,这个玩法挺火的嘛,有没有试过更新QQ到5.1版本,QQ的健康里面就可以添加其他app,实现从QQ跳转到其他app应用.这个挺好玩的,一下子带来了多少流量啊. 一.先来 ...
- iOS App Store上架新APP与更新APP版本
iOS App Store上架新APP与更新APP版本 http://www.jianshu.com/p/9e8d1edca148
- walk around by The provided App differs from another App with the same version and product ID 分类: Sharepoint 2015-07-05 08:14 4人阅读 评论(0) 收藏
'm currently developing a SharePoint 2013 application. After a few deployments via Visual Studio, I ...
- Android项目实战(二十二):启动另一个APP or 重启本APP
一.启动另一个APP 目前公司项目需求,一个主APP,需要打开某些小APP,这些小APP是整合了Unity的,但是还是android程序(所有小APP的包名是已知的). 以前没做过,查询了一下实现方法 ...
- 原生APP与移动Web App的比较
中国手机网民已超4.5亿,智能机用户超过3.8亿,中国移动互联网市场产值已超过712.5亿元,手机营销是未来必然趋势,而App恰恰是这个趋势下的一个强有力的营销工具: App已有两个主要的方向:原生A ...
- 【Hybrid App】关于Hybrid App技术解决方案的选择
[引言]近年来随着移动设备类型的变多,操作系统的变多,用户需求的增加,对于每个项目启动前,大家都会考虑到的成本,团队成员,技术成熟度,时间,项目需求等一堆的因素.因此,开发App的方案已经变得越来越多 ...
- iPhone应用提交流程:如何将App程序发布到App Store?
对于刚加入iOS应用开发行列的开发者来说,终于经过艰苦的Coding后完成了第一个应用后最重要的历史时刻就是将应用程序提交到iTunes App Store.Xcode 4.2开发工具已经把App提交 ...
- Android - 和其他APP交互 - 让其他app启动你的activity
前面的两篇文章主要讲了一个方面:从app中启动其他app.但是如果你的app可以处理对其他app有用的操作,你的app也应该响应其他app的操作请求.例如,如果你创建了一个社交app可以分享信息和图片 ...
随机推荐
- matplotlib中使用imshow绘制二维图
#coding:utf-8 from matplotlib import mpl import matplotlib.pyplot as plt#载入matplotlib快速绘图的函数库 import ...
- EEPROM和flash的区别
存储器分为两大类:ram和rom.ram就不讲了,今天主要讨论rom. rom最初不能编程,出厂什么内容就永远什么内容,不灵活.后来出现了prom,可以自己写入一次,要是写错了,只能换一片,自认倒霉. ...
- 【转】Logistic regression (逻辑回归) 概述
Logistic regression (逻辑回归)是当前业界比较常用的机器学习方法,用于估计某种事物的可能性.比如某用户购买某商品的可能性,某病人患有某种疾病的可能性,以及某广告被用户点击的可能性等 ...
- Javascript禁止父元素滚动条滚动, pc、移动端均有效
在网页中经常会遇到这样的场景, 网页比较长有滚动条, 然后网页内的某个内容块里面的内容也比较长, 也具有滚动条.当鼠标移到内容块中使用滚动条来滚动查看内容到达底部或头部的时候,父元素的滚动条也就开始滚 ...
- ubuntu连接无线网
我的ubuntu是因为没有安装无线网卡驱动,首先查看网卡型号 但是我在Broadcom官网上没有找到BCM43142的驱动. 通过谷歌后发现通过安装bcwl-kernel-source来解决这个问题, ...
- win下vm10+mac os 10.9安装遇到问题
在windows 8下安装vm10.0.0+mac os 10.9遇到问题记录例如以下: 一.因为之前我装的vm9+mac os 10.7: 二.准备安装mac os 10.9,把vm9换成vm10: ...
- uva 103 Stacking Boxes(DAG)
题目连接:103 - Stacking Boxes 题目大意:有n个w维立体, 输出立体互相嵌套的层数的最大值, 并输出嵌套方式, 可嵌套的要求是外层立体的w条边可以分别对应大于内层立体. 解题思路: ...
- `npm install --save --save-exact react-native` failed
当你使用命令行创建一个项目 react-native init 项目名称 后出现以下错误 Installing react-native package from npm... /bin/sh: ...
- 无法加载协定为“XXXWebServiceSoap”的终结点配置部分,因为找到了该协定的多个终结点配置
错误描述:无法加载协定为“XXXWebServiceSoap”的终结点配置部分,因为找到了该协定的多个终结点配置.请按名称指示首选的终结点配置部分. 错误原因:该webservce在web.confi ...
- js清空页面控件值
function funClear() {var txts = document.getElementsByTagName("input");for (var i = 0; i & ...