Kickstarter Survey
Video Course on Real-Time HTML5 with Node.jsA survey site he did for Kickstarter.
A good example of middle-end architecture
function doGetProfile(req,res) {
collectPostData(req)
.val(processJSONPostData)
.val(function(sessionData){
return sessionData.session_id;
})
.seq(validateSession)
.val(function(sessionID){
return sessions[sessionID].user_id;
})
.seq(retrieveProfile)
.val(function(profileData){
res.end(JSON.stringify({
profile: profileData
}));
})
.or(function(err){
res.end(jsonError(err));
});
}
collectPostData(req)
will return a asynquence .val
synchronous steps (take the data from the previous step).seq(ValidateSession)
<- async task (will return a new sequence)when it completes:
.val(function(sessionID){ return sessions[sessionID].user_id; })or the error is caught at .or