Last updated: 03 Aug 2014.

When we approached the development of the MEAN.JS, we set a goal to make it as production ready as possible. Since we're already working in the Node.js eco-system (and have a strong opinion toward modular architecture) we decided that it would be best to enrich the stack with useful modules.

In this page you will find MEAN modules that will help you make your project better. We will try to solve common issues with the MEAN stack as well as finding new ways to extend its functionality without harming the core stack.


Enjoy & keep us updated,
The MEAN.JS Team.

Overview

MEAN-SEO is an Express middleware, which intercepts requests that include the _escaped_fragment_ parameter in the URL. It then launches the PhantomJS headless-browser, which creates a copy of the page and stores it in cache for future requests.

This allows the crawler to get your page content after the AngularJS application is fully loaded, thus providing it with your real content.

Caching

The MEAN-SEO module caches the page for the duration you define, either by saving the pages to the disk or to a Redis instance (requires installing Redis).

Quick Install

First you'll need to install the MEAN-SEO module using npm:

npm install mean-seo --save

Then include in you express application:

var seo = require('mean-seo');

And finally, just before you require the app.router middleware add the following:

app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
}));

// app.use(app.router) will be below this line 

If you use HTML5 URL scheme then you should let the crawler know you're serving an AJAX application by adding the following to the HEAD tag of your page:

<meta name="fragment" content="!">