var Member = require('./models/models');

function getMembers(res){
	Member.find(function(err, members) {

			if (err) {
				return res.send(err)	
			}

			console.log(members);
			res.json(members); // return all todos in JSON format
		});
};

function getMember(req, res){
	Member.findOne({_id: req.params.member_id}, function(err, members) {

			if (err) {
				return res.send(err)	
			}

			res.json(members); 
			console.log(members);
		});
};

function addMember (req, res) {
	member = new Member({name: req.params.name, password: req.params.pass, status: 0});
	
	member.save(function (err, obj) {	  
		if (err) {
			return res.send(err);
		}

		res.json(member);
	});
}

function removeMember (id, res) {
	Member.remove({_id: id}, function(err, obj) {
        if (err) {
            res.send(err);
        }

        res.json({ message: 'Member '+ id + 'Successfully deleted' });
    });
}

function updateStatus (req, res) {

	res.json({ message: 'Status updated. Member ' + req.params.memeber_id + ' is ' + req.params.status_id });
};

module.exports = function(app) {

// API Calls
	app.get('/api/ssnoc/directory', function(req, res) {
		getMembers(res);
	});

	app.get('/api/ssnoc/member/:member_id', function(req, res) {
		getMember(req, res);
	});

	app.get('/api/ssnoc/update_status/:memeber_id/:status_id', function(req, res) {
		updateStatus(req,res);
	});

	app.post('/api/ssnoc/member/:name/:pass', function(req, res) {

		addMember (req, res);
	});

	app.delete('/api/ssnoc/member/:member_id', function(req, res) {

		removeMember(req.params.memeber_id, res);

		//res.json({ message: 'member removed ' + req.params.memeber_id });
	});

	app.get('*', function(req, res) {
		res.sendfile(__dirname + '../public/index.html'); // load the single view file (angular will handle the page changes on the front-end)
	});
};
@@ -1527,17 +1527,16 @@
  res) %7B%0A
-%0A
 %09%09remove
@@ -1574,79 +1574,8 @@
 es);
-%0A%0A%09%09//res.json(%7B message: 'member removed ' + req.params.memeber_id %7D);
 %0A%09%7D)
@@ -1618,21 +1618,18 @@
 %7B%0A%09%09
-res.sendfile(
+appRoot = 
 __di
@@ -1637,16 +1637,17 @@
 name + '
+/
 ../publi
@@ -1659,16 +1659,64 @@
 ex.html'
+;%0A%09%09console.log(appRoot);%0A%09%09res.sendfile(appRoot
 ); // lo

Fix API path