backend/ frontend • JavaScript is fun! • Can share frontend/backend code • No context switch between frontend/backend code • Non-blocking I/O is different and can be hard • Callback hell - hard to maintain code • missing/immature libraries Pros Cons Thursday, January 3, 13
so they can be used on the backend var headerTmpl = fs.readFileSync(__dirname + '/public/templates/header.hbs', 'utf-8'); hbs.registerPartial('header', headerTmpl); <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>Server Side Templates Example</title> <link rel="stylesheet" href="/stylesheets/ style.css"/> </head> <body> {{> header}} {{{body}}} </body> </html> Thursday, January 3, 13
success and failure logic • error-bubbling Comb provides plenty of methods for helping manage callbacks, as well as a million other things! http://c2fo.github.com/comb/index.html Thursday, January 3, 13
modules • First time using socket.io and connecting to twitter stream • follows #nebraskajs tagged tweets in real time • Try it now! tweet #nebraskajs • Source available at nicknisi/nebraskajs- tweets Thursday, January 3, 13