Skip to content

Instantly share code, notes, and snippets.

@nomoney4me
Created December 12, 2017 05:57
Show Gist options
  • Save nomoney4me/96aee6f21018d926ebcaec7767d6fa0e to your computer and use it in GitHub Desktop.
Save nomoney4me/96aee6f21018d926ebcaec7767d6fa0e to your computer and use it in GitHub Desktop.
var io = require('socket.io').listen(server);
// ----------------- https server ---------
app.use(express.static(__dirname+'/public'));
app.use(bodyParser.urlencoded({ extended: false }))
// ---------------------------custom function -----------------------
/*
-----------------------------------------
displayList()
-----------------------------------------
*/
function displayList(gradelevel) {
var now = moment().startOf('day').format('YYYY-MM-DD HH:mm:ss');
var query = process.env.query;
var studentList = knex.raw(query).then((result) => {
return result.rows
})
studentList.then((list) => {}, [])
var newList = list;
// do alot of things and then return newList
io.to(gradelevel).emit('students result list', newList)
})
} //end displayList()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment