Blog Express.js Web Application Example

Here is one of the main examples that is featured in the book: the Blog application built with Express.js, MongoDB and Mongoskin. The application is subject to change, but if you’re an intermediate or advance Node.js programmer, go ahead and poke the source code, kick the tires of the server. It’s not a Ghost blogging platform, but blog-express can give valuable practical tips on how to implement:

Session-based authentication
Express.js middleware authorization
MVC-like pattern using lightweight MongoDB library called Mongoskin
REST API server
Express.js routes organization
Jade and server-side rendering

Blog Express.js App Admin Page

For the past few weeks, I’ve been writing a new book on Node.js. Hence the lack of new posts. This time, the book encompasses virtually all of the practical aspects of web development using Node.js: authentication, authorization, OAuth with third-party service providers, testing, libraries, frameworks, databases, ORMs and MVC-like patterns. In other words, if you have to read only one book on Node.js (which is not a good advice, but let’s assume), this will be the book that you have to read. :-)

The title and the alpha sign up are in secret for now (subscribe to get the news faster). The book is due in early spring 2014.

Here is one of the main examples that is featured in the book: the Blog application built with Express.js, MongoDB and Mongoskin. The application is subject to change, but if you’re an intermediate or advance Node.js programmer, go ahead and poke the source code, kick the tires of the server. It’s not a Ghost blogging platform, but blog-express can give valuable practical tips on how to implement:

  • Session-based authentication
  • Express.js middleware authorization
  • MVC-like pattern using lightweight MongoDB library called Mongoskin
  • REST API server
  • Express.js routes organization
  • Jade and server-side rendering
Blog Express.js App Home Page
Blog Express.js App Home Page

GitHub: http://github.com/azat-co/blog-express

Author: Azat

Techies, entrepreneur, 20+ years in tech/IT/software/web development expert: NodeJS, JavaScript, MongoDB, Ruby on Rails, PHP, SQL, HTML, CSS. 500 Startups (batch Fall 2011) alumnus. http://azat.co http://github.com/azat-co

10 thoughts on “Blog Express.js Web Application Example”

  1. Nice, thank you. The problem wasn’t with req.session = null. It was with everyauth overwriting /logout route (I added it later and probably didn’t see the bug). So everyauth /logout wasn’t destroying the session and it never got to the proper /logout. Please try it now. PS: everyauth is so amazing that it automatically add /logout when it sees connect and/or express, cool right? ;-)

    https://github.com/azat-co/blog-express/commit/ee51f83c5ba609e245df7d690591378945ca6720

  2. posted the issue in the repo

    seems like req.session=null;

    did not clear the user sessions.

  3. i tried your app and it seems like there is an issue with logout function. it did not clear the user session

  4. Cool … I just wish mongoose was integrated in it. Also it would be more interesting to use if you would add an admin module. But still , the pattern of the app itself is very helpful.

  5. Not in this particular example. On the client-side, we just change classes on elements (here). But someone can use Underscore, jade-browser, Handlebars or any other front-end JS template engine with a Node.js REST API server.

    Jade-browser is something I maintained during my tenure at Storify. The benefit of this library is that same templates can be shared between server and browser.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.