Monday, August 26, 2013 10:08 AM

yanexbo - yet another node/express boilerplate

Author: matthias - Last modified: Monday, August 26, 2013 10:19 PM

en node  express mongoose  jade  boilerplate  github

After developing a couple of node applications utilizing express, mongoose and jade, I decided to create and publish a simple node/express boilerplate called yanexbo.

What's the purpose of it? yanexbo is a minimalistic boilerplate which can be used as a quick start for your next node project using express, mongoose and the jade templating engine. It suggests a simple yet slightly opinionated set of files and directories giving some structure to your application. It can easily grow into any direction of node/express app.

Clone or fork it from github:

https://github.com/atufkas/yanexbo

Comments, ideas, suggestions, improvements, pull requests are welcome!

Comment / Share »
Thursday, October 18, 2012 9:05 PM

Get on your feed: Using node-rss with express and mongojs

Author: matthias - Last modified: Friday, June 21, 2013 2:41 PM

en node-rss  rss  nodejs  express mongojs

This post shows a code snippet as an example for setting up a rss feed by integrating node-rss with express using a mongodb/mongojs result array.

Note: I just were going to add this stuff as a Gist on Github which at the time of writing this experiences major disruptions. Well, I'll do better publishing it directly in my blog by now.

Situation

For my tiny blog (engine) based on node, express/connect and mongojs I needed a simple rss feed solution. I discovered and decided to go with the nice working npm module node-rss instead of writing xml myself.

What this code example does

Basically I create an get event on route /feed/rss, generate a node-rss object initialized with base values and add item elements to it while looping over a mongojs collection result array (holding my post items to be reflected). Finally I send a response with an appropriate content type header. My example is directly bound to an express get event callback for a simple static request path, but you may of course move it to route exports or whatever.

Notes

No big deal, but you might find this portion of code useful as a starting point when seeking for rss solutions.

Comment / Share »
Thursday, September 27, 2012 5:47 PM

Hello, node! How I set up this blog.

Author: matthias - Last modified: Tuesday, October 9, 2012 8:35 AM

en blog  nodejs  express mongodb  twitter bootstrap  jade  nodejitsu

Hello, world - hello, node!

I just launched this new site and - though far from a perfect state - I'm quite happy with the results. About two weeks ago I had the idea to start this as a project aiming three goals:

  • Relaunching my personal homepage - the agile way
  • Getting in touch with and a better understanding for the world of node.js
  • Testing and evaluating some fancy JS plugins and cloud services (SaaS/PaaS)

It took me about a week studying various blogs, articles, docs and of course code for getting an idea and roundup of the current development state, packages, paradigms and concepts. In the end, it was definitive worth reading! Not only that I now know how to npm install something but that I now got a clearer understanding of e.g. what kind of loose coupling is the preferred node way and so on.

So, what software packages make up this site? Here we go:

express: Ready-to-roll on node

Starting from scratch, I decided to write a little blog engine on my own as a node/JS exercise. Currently there's likely no way around using the beautiful and simple mvc/mvr framework express which is basically comparable to Ruby Sinatra and other lightweight web DSLs/frameworks.

mongodb: No SQL? noSQL!

As a storage backend for the blog entries and user authentication a my decision was made in favour of the document-oriented database mongoDB. I utilized the node-mongodb-native driver and mongojs as a convenient wrapper around it. Well, using a noSQL database for the first time was fun to me (and less painful than many other learning curves), but haven't gone any deeper than storing, updating, finding and sorting at a starters' level by now.

Some tests with popular modules like mongoose, other key-value-stores and multi-db orm layers are on my todo list. Stay tuned for updates on my experiences with noSQL!

Twitter Bootstrap: Solid UI layout foundation - finally!

Hard to ignore: Twitter Bootstrap helped me out a lot building this blog. I' making use of a pure boostrap 2.1.1 CSS / JS, a slightly customized bootstrap-responsive and few additional inline styles. Though I'm planning to move the layout towards a more individual style, I'm happy with the current state as a solid starting point.

jade: Templating, the convenient way

Templating with express is a matter of choice again. I decided to go with jade. I've never been a big friend of HTML templating languages that forces you to learn yet another syntax, but - since jade seems currently to be the no.1 choice for node/express applications - it was time to give it a try. And, okay... now I know what I was missing.

nodejitsu: Good bye old servers - hello, cloud!

Last but not least: The node app running this site is just freshly installed and currently hosted on nodejitsu. The service is still in a public beta stadium but as far as I can tell it works great: Easy account setup and deployment, great toolkit and excellent response times. A basic mongodb instance is easy to install with the "jitsu" tool as well - although it will be installed in the cloud of nodejitsus partner mongoHQ. No problems here either so far - welcome to the cloud!

Next time I'll also go for a deployment on heroku. Let's see who's winning the "simple agile approach for quick results".

Next: Read my blog!

The upcoming days and weeks I'll frequently

$ jitsu deploy

my site, extend its functionality and add new modules. I'm going to share my individual experiences with the world of node, related projects and my progress in building a real-world application.

Stay tuned!

Comment / Share »