Great nightmare with parse.com
announcing they will be closing down next year. Now I'm trying to test their suggested solution using MongoDB
. The problem is, I'm stuck with javascript
errors. I got the git in parse-servir-github
, added my app settings and ran the node index.js
. Now, I'm getting the error when trying to access the local server:
parse-server-example running on port 1337. /Users/ferrojr/DeveloperTools/parse-server/node_modules/express/lib/application.js:120 this._router.handle(req, res, function(err) { ^
TypeError: Cannot read property 'handle' of undefined at Function.app.handle (/Users/ferrojr/DeveloperTools/parse-server/node_modules/express/lib/application.js:120:15) at Server.app (/Users/ferrojr/DeveloperTools/parse-server/node_modules/express/lib/express.js:28:9) at emitTwo (events.js:87:13) at Server.emit (events.js:172:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:528:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
Here's is the code in application.js
.
app.handle = function(req, res, done) {
var env = this.get('env');
this._router.handle(req, res, function(err) {
if (done) {
return done(err);
}
// unhandled error
if (err) {
// default to 500
if (res.statusCode < 400) res.statusCode = 500;
debug('default %s', res.statusCode);
// respect err.status
if (err.status) res.statusCode = err.status;
// production gets a basic error message
var msg = 'production' == env
? http.STATUS_CODES[res.statusCode]
: err.stack || err.toString();
msg = escapeHtml(msg);
// log to stderr in a non-test env
if ('test' != env) console.error(err.stack || err.toString());
if (res.headersSent) return req.socket.destroy();
res.setHeader('Content-Type', 'text/html');
res.setHeader('Content-Length', Buffer.byteLength(msg));
if ('HEAD' == req.method) return res.end();
res.end(msg);
return;
}
// 404
debug('default 404');
res.statusCode = 404;
res.setHeader('Content-Type', 'text/html');
if ('HEAD' == req.method) return res.end();
res.end('Cannot ' + escapeHtml(req.method) + ' ' + escapeHtml(req.originalUrl) + '\n');
});
};
Anyway, I'm a iOS developer
with no experience on node.js
, I'm just trying to follow parse.com
tutorial and setup my database to use mongoDB
and parse server
locally.
Any help is highly appreciated.