const express = require('express');
const app = express();
const logger = require('morgan');
const http = require('http');
const path = require('path');
const PORT = process.env.PORT || 8080;
const bodyParser = require('body-parser');
const baseAPI = '/api/v1';
const cors = require('cors');

app.use(cors());
app.use(bodyParser.json({limit: '50mb', extended: true}))
app.use(logger('dev'));
app.use(bodyParser.urlencoded({
	limit: '50mb',
    extended: true
}));


//http://localhost:8080/

app.get('/', function (req, res) {
	res.send('API restful sobre videojuegos hecho con javascript y mongoDB.');
});

//Hace uso de videogames-service y videogames

const converter = require('./routes/latex2pdf');

app.use('/latex2pdf', converter);

const server = http.createServer(app);

server.listen(PORT, function () {
    console.log('Server up and running on localhost:' + PORT);
});
