Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require ('app') for express 3.0 #90

Open
alvaromuir opened this issue Dec 3, 2012 · 1 comment
Open

Require ('app') for express 3.0 #90

alvaromuir opened this issue Dec 3, 2012 · 1 comment

Comments

@alvaromuir
Copy link

Newbie question, but Tobi seems to think my server is never listening....

// server.js

var port = 3000;

module.exports = http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});

// tobi

var app = require('./server')
var browser = require('tobi').createBrowser(app);

// Express server listening on port 3000

browser.get('/', function(res, $){
console.log(res)
});

browser.server

.........
_connectionKey: '4:127.0.0.1:9001',
__deferred:
[ { '0': 'GET',
'1': '/',
'2': {},
'3': [Function],
'4': undefined },
{ '0': 'GET',
'1': '/',
'2': {},
'3': [Function],
'4': undefined } ],
__port: 9001,
__started: true }

Why port 9001, and why does it think my server isn't running?

@brettcave
Copy link

Not sure if this has anything to do with it: https://github.com/LearnBoost/tobi

Browser

Tobi provides the Browser object, created via tobi.createBrowser(app), where app is a node http.Server, so for example Connect or Express apps will work just fine. There is no need to invoke listen() as this is handled by Tobi, and requests will be deferred until the server is listening.

Alternatively you may pass a port and host to createBrowser(), for example:

var browser = tobi.createBrowser(80, 'lb.dev');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants