Mike Valstar
See Coding with Node.js: Part 1; Getting started with Express. for the beginning of this tutorial series.
Node is a fast moving technology, and so to this applies to the libraries and tools. since I started this blog Node has been upgraded from 6.0 to 8.12, and express has migrated from 2.5.0 to 3.0.0 and mongoose is now at 3.2 as well.
Express in 3.0.0 has added and removed quite a few things. you can read more here: https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x
For the purposes of this project the major changes come in 3 places:
Express has been changed to break out the http server from the main express itself as a separate module; thus changing slightly how we interact with express, but not overly effecting this blog.
In addition Express has added a nice built in log for development purposes.
And lastly they have added in a new prefered method of setting the port.
The error handler is mainly affected by the removal of the status option from res.render() to it’s own call.
Finally all of our templates need to be updated, express no longer renders a layout.jade file then inserts your “content”. The new method uses jade’s “extend” and “block” functionallity
Replace != body
block content
Add to the top:
extends layout
block content
Mongoose in reference to this application has only had one change that I have been able to find; and that is in reference to how you sort your queries.
blogpost.find().sort("sid", -1)
blogpost.find().sort(“-sid")
A subtle differnce, butenough tomake your application no longer work.
All code created for this website is available on the github page page and this tutorial specifically is available here: Tag: NodeTutorial_pt7
Sorry for the massive change, I converted the project from tabs to spaces for indenting. You can see a diff of all the changes here: Commit: 37986074d43d2194f8e6c5f3234e9a7f1c88ede4
Shortly I’ll be releasing some information about the site redesign. After that I plan on adding a site search.