var express    = require('express'),
    bookRouter = require('./routes/books.js'),
    bodyParser = require('body-parser');

var app  = express();
var port = process.env.PORT || 3000;

app.listen(port, function () {
  console.log('Express server listening on port ' + port);
});

app.get('/', function (req, res) {
  res.send('welcome to my API');
});

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
  extended: true
}));

// Book Router
app.use('/api/books', bookRouter);
