0.1.0 • Published 9 years ago

magnetic-express v0.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

magnetic-express

Magnetic Express is an Express middleware for Magnetic - a tool that makes it easy for you to add automatic server-side static rendering to your dynamic single-page app.

Your site must use URL fragments in the format of #!/path in order for crawlers to automatically request the corresponding paths at /?_escaped_fragment_=/path.

The Magnetic middleware will detect these requests and start a headless browser using Horseman and PhantomJS to render the corresponding #!/path page of your site.

These rendered pages will then be returned in the response to the crawler.

Example

var express = require('express');
var magnetic = require('magnetic-express');

var app = express();
app.get('/', magnetic());

Now any GET request to / that contains an _escaped_fragment_ query string parameter will be rendered to static HTML by Magnetic.