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
Thanks so much Azat, I was looking for examples to know how to structure my project as it’s becoming hard to maintain it. Have a great day bro!
nice app example.thanks for your advice.
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
posted the issue in the repo
seems like req.session=null;
did not clear the user sessions.
Maybe, could you please submit the exact steps to the GitHub issues for this repo?
i tried your app and it seems like there is an issue with logout function. it did not clear the user session
Yes, the admin module/page is there!
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.
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.
>Jade and server-side rendering
So you also render the templates on the client ?