エクスプレス初心者です。私がルーティングを行っている方法は、エラーをキックバックすることです。
これが私の関連コードです:
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 と play.js
exports.index = function(req, res){
res.sendfile('views/index.html');
};
exports.play = function(req, res){
res.sendfile('views/play.html');
};
これはエラーです:
エラー: .get() にはコールバック関数が必要ですが、[object Undefined] を取得しました
app.js でこの行を参照します。
app.get('/play', routes.play);
コード構造がインデックス ページへのルーティングと同じであり、インデックス ページが完全に読み込まれるため、これが機能しない理由がわかりません。
何か案は?ありがとう