let Resource = require('../models/resource');

module.exports.all = (req, res) => {
	Resource.find({}, function(err, resources) {
	  if (err) throw err;

	  console.log(resources);
	});
};

module.exports.one = (req, res) => {
	Resource.find({ id: '55' }, function(err, resource) {
	  if (err) throw err;

	  console.log(resource);
	});
};

module.exports.new = (req, res) => {
	var newResource = Resource({
	  title: 'Resource +' (new Date()),
	  description: 'Node + React',
	  rating: 4
	});

	newResource.save(function(err) {
	  if (err) throw err;

	  console.log('Resource created!');
	});
};

module.exports.update = (req, res) => {
	Resource.findById(1, function(err, resource) {
	  if (err) throw err;

	  resource.title = 'New title';

	  resource.save(function(err) {
	    if (err) throw err;

	    console.log('Resource successfully updated!');
	  });
	});
};

module.exports.remove = (req, res) => {
	Resource.find({ id: '55' }, function(err, resource) {
	  if (err) throw err;

	 resource.remove(function(err) {
    if (err) throw err;

    console.log('Resource successfully deleted!');
	});
};

module.exports.index = (req, res) => {
  res.set('Content-Type', 'application/json');
  let text = `Hello from the backend server @ ${new Date()}`;
  res.send('{"message":"' + text + '"}');
};

@@ -987,16 +987,17 @@
 err;%0A%0A%09 
+%09
 resource
@@ -1020,16 +1020,17 @@
 (err) %7B%0A
+%09
     if (
@@ -1046,16 +1046,17 @@
 w err;%0A%0A
+%09
     cons
@@ -1090,32 +1090,39 @@
 lly deleted!');%0A
+%09  %7D);%0A
 %09%7D);%0A%7D;%0A%0Amodule.
@@ -1106,32 +1106,33 @@
 %09  %7D);%0A%09%7D);%0A%7D;%0A%0A
+%0A
 module.exports.i

Update schema model.