I'm new to Express. The way I'm doing my routing is kicking back an error.
Here is my relevant code:
app.js
var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path')
, firebase = require('firebase');
...
// Routing
app.get('/', routes.index);
app.get('/play', routes.play);
index.js and play.js
exports.index = function(req, res){
res.sendfile('views/index.html');
};
exports.play = function(req, res){
res.sendfile('views/play.html');
};
This is the error:
Error: .get() requires callback functions but got a [object Undefined]
It references this line in app.js
app.get('/play', routes.play);
I'm lost as to why this doesnt work because the code structure is identical for routing to my index page and the index page loads perfectly.
Any ideas? Thanks
routes.jsin your current directory? Throw a quick line prior to initializing express checking ifroutesisundefinedor not. Could just be a pathing problem.