Skip to content

Instantly share code, notes, and snippets.

@Sen
Created March 21, 2013 08:09
Show Gist options
  • Save Sen/5211454 to your computer and use it in GitHub Desktop.
Save Sen/5211454 to your computer and use it in GitHub Desktop.
angular.js seo
phantom = require("phantom")
express = require("express")
app = express()
app.get "*", (req, res) ->
phantom.create (ph) ->
ph.createPage (page) ->
page.open "http://localhost:9000/#{req.route.params[0]}", (status) ->
page.evaluate (-> document.getElementsByTagName('html')[0].outerHTML), (result) ->
res.end result
ph.exit()
app.listen(3002)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment