1.0.0 • Published 8 years ago
swayzee v1.0.0
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
- Improve the phantom response handling, onConsoleLog i think is not pretty way
Improvements
- Dynamicly set multiple ORIGINS.
- BlackList
- Caching Handler (Now only avaible s3)
How to start
- Point the ORIGIN the url of your server.
npm start
ornode swayzee.js --harmony
- Make a request:
http://localhost:1333/&escaped_fragment=/url/example`
Inspired in prerender.io.
1.0.0
8 years ago