Created
April 1, 2011 19:04
-
-
Save halldb02/898666 to your computer and use it in GitHub Desktop.
description of edits to enhance server.js for node-boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script>SOCKET_IO_PORT = <%= port %>;</script> | |
<script src="/js/socket.io.js"></script> | |
... | |
<!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID --> | |
<script> | |
var _gaq=[["_setAccount","<%= googleAnalyticsSiteId %>"],["_trackPageview"]]; | |
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1; | |
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js"; | |
s.parentNode.insertBefore(g,s)}(document,"script")); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
//io.setPath('/client/'); | |
socket = new io.Socket(null, { | |
port: SOCKET_IO_PORT | |
,transports: ['websocket', 'htmlfile', 'xhr-multipart', 'xhr-polling'] | |
,path: '/client/' | |
}); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// at the top of the file, or in a site config file: | |
var googleAnalyticsSiteId = 'UA-XXXXX-X'; | |
... | |
// THREE PLACES: 404, 500, index, etc. Consider using a default "locals" object that is extended for each instance. | |
res.render('VARIOUS TEMPLATES', {locals: { | |
... | |
googleAnalyticsSiteId: googleAnalyticsSiteId, | |
port: port // only needed for the index.ejs route | |
}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment