api/server.js
/*
	Respond with the current week's canteen menu
*/
Respond with the current week's canteen menu
Respond with the current week ' s canteen menu
function respondCurrentMenu(req, res, next) {
	var lastSunday = moment().day("Sunday");
	var nextSunday = moment().day("Sunday").add(7, 'days');
	console.log('respondCurrentMenu:', 'Query between ', lastSunday.format("YYYY-MM-DD"), nextSunday.format("YYYY-MM-DD"));
	queryDatabase("SELECT data FROM menus WHERE data->>'date' > $1 AND data->>'date' < $2 ", 
		[lastSunday.format("YYYY-MM-DD"), nextSunday.format("YYYY-MM-DD")],
		function(response) {
		res.send( response.rows );
		next();
	});
}
function respondCurrentMenu ( req , res , next ) { var lastSunday = moment ( ) . day ( "Sunday" ) ; var nextSunday = moment ( ) . day ( "Sunday" ) . add ( 7 , 'days' ) ; console . log ( 'respondCurrentMenu:' , 'Query between ' , lastSunday . format ( "YYYY-MM-DD" ) , nextSunday . format ( "YYYY-MM-DD" ) ) ; queryDatabase ( "SELECT data FROM menus WHERE data->>'date' > $1 AND data->>'date' < $2 " , [ lastSunday . format ( "YYYY-MM-DD" ) , nextSunday . format ( "YYYY-MM-DD" ) ] , function ( response ) { res . send ( response . rows ) ; next ( ) ; } ) ; }
Respond with the current week's canteen menu
Respond with the current week ' s canteen menu