Skip to content

Instantly share code, notes, and snippets.

@WowSuchRicky
Created October 13, 2015 20:02
Show Gist options
  • Select an option

  • Save WowSuchRicky/bfa3768befac30eb1000 to your computer and use it in GitHub Desktop.

Select an option

Save WowSuchRicky/bfa3768befac30eb1000 to your computer and use it in GitHub Desktop.
/**
* Created with JetBrains WebStorm.
* User: Ricky
* Date: 7/31/13
* Time: 10:17 PM
* To change this template use File | Settings | File Templates.
*/
require('newrelic');
var express = require('express'),
http = require('http'),
port = Math.floor(process.argv[2]) || process.env.PORT || 1337, //rudimentary integer check
app = express(),
server = app.listen(port),
io = require('socket.io').listen(server);
/* FOR ANGULAR ROUTING vvvv */
app.use(express.static(__dirname + "/public"));
app.all('/*', function(req, res) {
res.sendfile('public/index.html');
});
/* FOR REGULAR EXPRESS ROUTING */
//app.use(app.router);
//app.use(function(req, res) {
// // Use res.sendfile, as it streams instead of reading the file into memory.
// res.sendfile(__dirname + '/public/index.html');
//});
io.sockets.on("connection", function (socket) {
"use strict";
console.log("Socket initialized");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment