Closed ChristianGaertner closed 10 years ago
What's in your api/responses/ok.js
? Looks like that's where the error is coming from...
This is the exact copy of cat ok.js
(using cat ok.js | pbcopy
):
(I haven't modified this file in any way!)
/**
* 200 (OK) Response
*
* Usage:
* return res.ok();
* return res.ok(data);
* return res.ok(data, view);
* return res.ok(data, redirectTo);
* return res.ok(data, true);
*
* @param {Object} data
* @param {Boolean|String} viewOrRedirect
* [optional]
* - pass string to render specified view
* - pass string with leading slash or http:// or https:// to do redirect
*/
module.exports = function sendOK (data, viewOrRedirect) {
// Get access to `req` & `res`
var req = this.req;
var res = this.res;
// Serve JSON (with optional JSONP support)
function sendJSON (data) {
if (!data) {
return res.send();
}
else {
if (typeof data !== 'object') { return res.send(data); }
if ( req.options.jsonp && !req.isSocket ) {
return res.jsonp(data);
}
else return res.json(data);
}
}
// Set status code
res.status(200);
// Log error to console
this.req._sails.log.verbose('Sent 200 ("OK") response');
if (data) {
this.req._sails.log.verbose(data);
}
// Serve JSON (with optional JSONP support)
if (req.wantsJSON) {
return sendJSON(data);
}
// Make data more readable for view locals
var locals;
if (!data || typeof data !== 'object'){
locals = {};
}
else {
locals = data;
}
// Serve HTML view or redirect to specified URL
if (typeof viewOrRedirect === 'string') {
if (viewOrRedirect.match(/^(\/|http:\/\/|https:\/\/)/)) {
return res.redirect(viewOrRedirect);
}
else return res.view(viewOrRedirect, locals, function viewReady(viewErr, html) {
if (viewErr) return sendJSON(data);
else return res.send(html);
});
}
else return res.view(locals, function viewReady(viewErr, html) {
if (viewErr) return sendJSON(data);
else return res.send(html);
});
};
Sorry, we're pushing rc7
today to fix a couple of issues that sneaked into Tuesday's release. If you pull the master branch of Sails (or do npm install -g sails@git://github.com/balderdashy/sails.git
) the issue should be resolved.
Okey great. Is there any ETA for 0.10 so far? (Couldn't find any...)
Balderdash has had a lot of client work lately, which is nice (it keeps the lights on), but it has delayed the finishing touches on v0.10 somewhat. Release hiccups aside, we're mainly just polishing up documentation at this point. We really hope to have it out this month.
Sounds awesome!
I' ve just done a clean install of the sails v0.10.0-rc6. I've run these (and only these commands):
sails lift`
npm install -g sails@beta'
sails new testWorks great! Then I generated my first model:
sails generate api user
and started the server again
sails lift
The homepage at
localhost:1337
still works. But when I navigate to the newly created resource (/user
) I get the following error:I think it is quite annoying when a clean and fresh install just errors... Or did I something wrong? (This problem is reproducible every time!)
Cheers, Christian