How do I set up express.io when I have files for each route. I'm struggling to apply the examples.
I have a standard Express I'm trying to convert to express.io:
Project
app.js
routes
servepage.js
Views
servepage.jade
public
main.js <-- client side javascript
In the Routing example, they put this code in app.js:
var express = require('express.io');
.... lots of Express routes omitted
app.io.route('ready', function(req) {
req.io.emit('talk', {
message: 'io event from an io route on the server'
})
})
I put just the route definition in app.js:
app.io.route('ready', servepage);
and get:
TypeError: undefined is not a function
How do I set up the app using more than just app.js? And why is it giving me this error?
EDIT: The servepage.js file has:
var express = require('express');
and not:
var express = require('express.io');
because this generates an error.