magnetic-express

0.1.0 • Public • Published

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.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i magnetic-express

    Weekly Downloads

    2

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • neodon1014