/*
|--------------------------------------------------------------------------
| Basic Setup
|--------------------------------------------------------------------------
*/

var express        = require('express');
var mongoose       = require('mongoose');
var bodyParser     = require('body-parser');
var morgan         = require('morgan');
var _              = require('underscore');
var methodOverride = require('method-override');
var Schema         = mongoose.Schema;
var app            = express();
var router         = express.Router();
var port           = process.env.PORT || 3000;
var restify        = require('express-restify-mongoose');
var apiVersion     = '/v1';

/*
|--------------------------------------------------------------------------
| Import Models
|--------------------------------------------------------------------------
*/

var Photo = require('./models/photo');

/*
|--------------------------------------------------------------------------
| Database Connection with Mongoose
|--------------------------------------------------------------------------
*/

mongoose.connect('mongodb://localhost/hoveyfamilyphotos');

/*
|--------------------------------------------------------------------------
| Configure the App
|--------------------------------------------------------------------------
*/

// BodyParser for handling JSON bodies in POST requests
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(methodOverride());

// Morgan to log requests to the console
app.use(morgan('dev'));

/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
*/

// Add headers
app.use(function (req, res, next) {

  // Website you wish to allow to connect
  res.setHeader('Access-Control-Allow-Origin', '*');

  // Request methods you wish to allow
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');

  // Request headers you wish to allow
  res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');

  // Set to true if you need the website to include cookies in the requests sent
  // to the API (e.g. in case you use sessions)
  res.setHeader('Access-Control-Allow-Credentials', true);

  // Pass to next layer of middleware
  next();

});

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
*/

// Base route
router.get('/'+apiVersion, function(req, res) {
  res.json({ message: 'Good stuff! You have reached the base endpoint for the API.' });
});

// Define Restify options
var restifyOptions = {
  prefix: '',
  version: apiVersion,
  lowercase: true,
  plural: true
};

// Set up routes for models with restify
restify.serve(router, Photo, restifyOptions);
app.use(router);

/*
|--------------------------------------------------------------------------
| Start the server!
|--------------------------------------------------------------------------
*/

var server = app.listen(port, function() {

  var host = server.address().address;
  console.log('Example app listening at http://%s:%s', host, port);

});
@@ -841,24 +841,64 @@
 -------%0A*/%0A%0A
+var User    = require('./models/user');%0A
 var Photo = 
@@ -895,16 +895,18 @@
 r Photo 
+  
 = requir
@@ -925,16 +925,98 @@
 photo');
+%0Avar Gallery = require('./models/gallery');%0Avar Tag     = require('./models/tag');
 %0A%0A/*%0A%7C--
@@ -3035,16 +3035,108 @@
 tions);%0A
+restify.serve(router, Gallery, restifyOptions);%0Arestify.serve(router, Tag, restifyOptions);%0A
 app.use(

Add models and routes to server.js