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可以分享信息和图片 ...
随机推荐
- Deep Learning for Natural Language Processing1
Focus, Follow, and Forward Stanford CS224d 课程笔记 Lecture1 Stanford CS224d 课程笔记 Lecture1 Stanford大学在20 ...
- 动态规划-Burst Balloons
Burst Balloons Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it ...
- 解除被DenyHosts锁定的IP地址
自己的本本无法ssh上服务器,提示 ssh_exchange_identification: read: Connection reset by peer 仔细回想,自己手贱把~下面的一个ssh文件删 ...
- C++ typeid实现原理
最近看了boost::any类源码,其实现主要依赖typeid操作符.很好奇这样实现的时间和空间开销有多大,决定探一下究竟. VS2008附带的type_info类只有头文件,没有源文件,声明如下: ...
- kernal linear regression
- 向未声明的 JavaScript 变量来分配值
如果您把值赋给尚未声明的变量,该变量将被自动作为全局变量声明. 这条语句: carname="Volvo"; 将声明一个全局变量 carname,即使它在函数内执行.
- 递推计数-hdu-4747-Mex
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4747 题目大意: 给n个数,求所有区间内没有出现的最小非负整数和. 解题思路: 首先感谢大神博客:h ...
- 基于Platinum库的DMS实现(android)
接上篇博文:基于Platinum库的DMR实现(android) 文章讲述了如何使用Platinum库实现DMR 今天同样使用该库,来讲解一下DMS的实现 关于该库如何编译,请参考这篇博文:NDK下 ...
- Linux学习之十五、基础正规表示法\延伸正规表示法
原文地址: http://vbird.dic.ksu.edu.tw/linux_basic/0330regularex_2.php 基础正规表示法 既然正规表示法是处理字串的一种表示方式,那么对字节排 ...
- node配置运行环境变量;
node express 在开发环境和生产环境运行的代码是不一样的, 通常是先配置好的,在开发环境运行一套代码,在生产环境运行另一套代码, 开发环境 development, 生产环境producti ...