Site Meter
 
 

Node.js development with WebMatrix 2 + Express (Part 2)

This is the second in a three-part series of videos about building a mobile web app with Node.js, Express, and WebMatrix:

  1. Getting started with Node and Express using WebMatrix 2 — 12 minutes
  2. (This post) Building a web app with static UI / dynamic API architecture — 20 minutes
  3. Hints and tricks for optimising for mobiles — 14 minutes

In this second video, we build on the Node.js + Express skills learned in the first video, and create a fun social web app that demonstrates how you can totally separate your application’s UI from its underlying API by using Express’s ability to mount one application inside another. This isn’t only about keeping your code tidy: it also enables some dramatic performance benefits, as you’ll see in Part 3, and means you could easily attach multiple UI technologies to the same underlying backend.

OK, here’s the video. Be sure to watch it full-screen in 720p quality, by the way, for the most readable code…

Want to download the code?

If you want to get a closer look at the code created in this tutorial, you can download the version corresponding to the end of part 2, or browse the whole source repo on GitHub.

13 Responses to Node.js development with WebMatrix 2 + Express (Part 2)

  1. Dmitry

    Pls tell me, what css framework did you ised on knockoutjs dot com

  2. Steve

    Dmitry – check the source. It uses the Tripoli CSS file.

  3. Guy

    Thanks Steve. These node.js presentations have been really interesting and educational. I also agree that you have a great “radio” voice! :)

  4. One minute its ASP.net MVC, Ninject, Entity Framework, Unit testing and Moq, then its MVC, SPA, upshot, knockout, SignalR. And now this?!
    Throw me a fricking bone here Steve!!!! Are you just very fickle or are you like a spaniel not knowing what toy to play with next?

    P.S its not like i’m stalking you or anything
    P.P.S I’m glad MS are paying you to produce this stuff

  5. Steve

    Guy – Glad you like them! Thanks.

    MattB – Hey, nobody’s trying to take away ASP.NET MVC and its friends… :) Those are still solid, excellent technologies that have a great future ahead of them and will be completely mainstream for .NET developers for many years to come. Node.js is much more of a niche interest right now, but it *is* interesting, and worth talking and learning about, and even using for projects where you really want to focus on JavaScript end-to-end, hence these videos. Your technology choice is very much *your* choice.

  6. Hi Steve,

    I’ve learned ASP.NET MVC by your brilliant book. Nowadays I do node.js development too, so I’m happy you are producing materials like this.

    It was really interesting. Waiting for next node.js issues!

  7. Tell me please the name of the tool you did the design sketches with

  8. bonomo

    Great job Steven!
    I am sorry to say, but your second example doesn’t work starting from the ‘ejs-middlewhere’ part as of 2012-07-18. Problem is that “npm install express” installs Express 3 which has some breaking changes (there is no ‘use’ or ‘register’ functions on the app object anymore). The “Object # has no method ‘use’” error is thrown.

    The problem can be fixed however by installing Express 2 by running ‘npm install express@2.x’.

    mode info on a problem can be found here: http://piscisaureus.no.de/node.js/2012-06-29

    Other than that I really enjoyed this 3 videos!

  9. bonomo

    Steven, why do you use “self” in closures instead of passing this around in your viewmodels?

  10. Similar to bonomo, the tutorial breaks in part 2, but worse, I can’t get the thing to load or respond to ANY path based request ( /invitations/test gives 404 no matter what). I double checked my code, and used the exact code from git too.

  11. I ran into the same issue as bonomo. I fixed it by changing the express entry in packages.json to:
    “express”: “= 2.5.11″,

    But great tutorial, this is the first time I’ve had a look at node, and this is a really helpful introduction.

  12. Hey there just wanted to give you a quick heads up.
    The text in your article seem to be running off the screen in Internet explorer.
    I’m not sure if this is a format issue or something to do with browser compatibility but I thought I’d
    post to let you know. The design look great though!
    Hope you get the issue solved soon. Thanks

  13. aman tur

    Dear Steve,

    I cannot thank you enough for such a nice introduction to nodejs for MS developers. I can understand that it is very difficult for you, but if you can update it for the breaking changes due to updated version of Express and EJS it will be very helpful.
    Regards