<<<<<<< HEAD
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var routes = require('./routes/index');
var users = require('./routes/users');
var jobs = require("./routes/jobs");
const mongoose = require("mongoose");
mongoose.connect('mongodb://localhost/aspjobs');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', routes);
app.use('/users', users);
app.use('/jobs', jobs);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handlers

// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: err
    });
  });
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});

=======
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');

const routes = require('./routes/index');
const users = require('./routes/users');
const jobs = require('./routes/jobs');
const mongoose = require("mongoose");
const hbs = require('express-hbs');

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

let app = express();

app.engine('hbs', hbs.express4({
  partialsDir: __dirname + '/views'
}));

// hbs.registerPartial('userMessage',
//     '');

app.set('view engine', 'hbs');
app.set('views', __dirname + '/views');

// var hbs = handlebars.create({
//   partialsDir :__dirname
//  });

//  hbs.engine(__dirname + "/views/index.html", {name:"Jakob"}, function(err, html) {
//   if (err) {
//     throw err;
//   }
//   console.log(html);
// }); 

class Server {

    constructor() {
        this.config();
        this.routeConfig();
        this.errorConfig();
    }

    config() {
        app.use(logger('dev'));
        app.use(bodyParser.json());
        app.use(bodyParser.urlencoded({extended: false}));
        app.use(cookieParser());
        app.use(require('node-sass-middleware')({
            src: path.join(__dirname, 'public'),
            dest: path.join(__dirname, 'public'),
            indentedSyntax: true,
            sourceMap: true
        }));
        app.use(express.static(path.join(__dirname, 'public')));
        app.use("/stylesheets",express.static(__dirname + "/stylesheets"));
        console.log(path.join(__dirname, 'public'));
    }

    routeConfig() {
        app.use('/', routes);
        app.use('/users', users);
        app.use('/job', jobs);

        app.use((req, res, next) => {
            let err = new Error('Not Found');
            err.status = 404;
            next(err);
        });
    }

    errorConfig() {
        if (app.get('env') === 'development') {
            app.use((err, req, res, next) => {
                res.status(err.status || 500);
                res.render('error', {
                    message: err.message,
                    error: err
                });
            });
        }

        app.use((err, req, res, next) => {
            res.status(err.status || 500);
            res.render('error', {
                message: err.message,
                error: {}
            });
        });
    }

    static bootstrap() {
        return new Server();
    }
}

Server.bootstrap();
>>>>>>> 65262abb3ad78f4ef045f11a13e99c4d70904c6c

module.exports = app;

@@ -1,17 +1,4 @@
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
 var 
@@ -1563,2612 +1563,8 @@
 );%0A%0A
-=======%0Aconst express = require('express');%0Aconst path = require('path');%0Aconst favicon = require('serve-favicon');%0Aconst logger = require('morgan');%0Aconst cookieParser = require('cookie-parser');%0Aconst bodyParser = require('body-parser');%0A%0Aconst routes = require('./routes/index');%0Aconst users = require('./routes/users');%0Aconst jobs = require('./routes/jobs');%0Aconst mongoose = require(%22mongoose%22);%0Aconst hbs = require('express-hbs');%0A%0Amongoose.connect('mongodb://localhost/aspjobs');%0A%0Alet app = express();%0A%0Aapp.engine('hbs', hbs.express4(%7B%0A  partialsDir: __dirname + '/views'%0A%7D));%0A%0A// hbs.registerPartial('userMessage',%0A//     '');%0A%0Aapp.set('view engine', 'hbs');%0Aapp.set('views', __dirname + '/views');%0A%0A// var hbs = handlebars.create(%7B%0A//   partialsDir :__dirname%0A//  %7D);%0A%0A//  hbs.engine(__dirname + %22/views/index.html%22, %7Bname:%22Jakob%22%7D, function(err, html) %7B%0A//   if (err) %7B%0A//     throw err;%0A//   %7D%0A//   console.log(html);%0A// %7D); %0A%0Aclass Server %7B%0A%0A    constructor() %7B%0A        this.config();%0A        this.routeConfig();%0A        this.errorConfig();%0A    %7D%0A%0A    config() %7B%0A        app.use(logger('dev'));%0A        app.use(bodyParser.json());%0A        app.use(bodyParser.urlencoded(%7Bextended: false%7D));%0A        app.use(cookieParser());%0A        app.use(require('node-sass-middleware')(%7B%0A            src: path.join(__dirname, 'public'),%0A            dest: path.join(__dirname, 'public'),%0A            indentedSyntax: true,%0A            sourceMap: true%0A        %7D));%0A        app.use(express.static(path.join(__dirname, 'public')));%0A        app.use(%22/stylesheets%22,express.static(__dirname + %22/stylesheets%22));%0A        console.log(path.join(__dirname, 'public'));%0A    %7D%0A%0A    routeConfig() %7B%0A        app.use('/', routes);%0A        app.use('/users', users);%0A        app.use('/job', jobs);%0A%0A        app.use((req, res, next) =%3E %7B%0A            let err = new Error('Not Found');%0A            err.status = 404;%0A            next(err);%0A        %7D);%0A    %7D%0A%0A    errorConfig() %7B%0A        if (app.get('env') === 'development') %7B%0A            app.use((err, req, res, next) =%3E %7B%0A                res.status(err.status %7C%7C 500);%0A                res.render('error', %7B%0A                    message: err.message,%0A                    error: err%0A                %7D);%0A            %7D);%0A        %7D%0A%0A        app.use((err, req, res, next) =%3E %7B%0A            res.status(err.status %7C%7C 500);%0A            res.render('error', %7B%0A                message: err.message,%0A                error: %7B%7D%0A            %7D);%0A        %7D);%0A    %7D%0A%0A    static bootstrap() %7B%0A        return new Server();%0A    %7D%0A%7D%0A%0AServer.bootstrap();%0A%3E%3E%3E%3E%3E%3E%3E 65262abb3ad78f4ef045f11a13e99c4d70904c6c%0A%0A
 modu

remove merge problems