import express from 'express';
import bodyParser from 'body-parser';
import favicon from 'serve-favicon';
import morgan from 'morgan';
import path from 'path';

const server = express();

server.use(bodyParser.json());
server.use(bodyParser.urlencoded({
    extended: false
}));

// setting up view engine
let viewpath = path.resolve('./','src','views');
console.log(viewpath);
server.set('views', viewpath);
server.set('view engine', 'pug');

// sigma by Sumana Chamrunworakiat from the Noun Project
server.use(favicon(path.resolve('./','assets','favicon.ico')));

// Morgan is middleware for logging requests
server.use(morgan('dev'));

export default server;