1.0.0 • Published 8 years ago

swayzee v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

Swayzee

Server to return static versions of your single page app.

How it works

When the server initializes it creates a phantomjs instance and opens a page with the url of the single page app. When the phantom is ready a express instance starts listening for page requests. When the phantom evaluation function detects that the title of the page has changed it returns the current html.

Conventions

  • Swayzee works with the #! escaped_fragment google convention.
  • Swayzee works with the watching the window.prerenderReady boolean value, it must be setted to true when the spa finish the rendering process.
  • Swayzee asumes that when the title changes means that the page has finished loading.
  • Swayzee looks for a this tag in the html <meta name="prerender-status-code" content="404"> to detect 404 errors.

TODO : Things to improve

Refactor

  1. Improve the phantom response handling, onConsoleLog i think is not pretty way

Improvements

  1. Dynamicly set multiple ORIGINS.
  2. BlackList
  3. Caching Handler (Now only avaible s3)

How to start

  1. Point the ORIGIN the url of your server.
  2. npm start or node swayzee.js --harmony
  3. Make a request: http://localhost:1333/&escaped_fragment=/url/example`

Inspired in prerender.io.