{"size": 978, "ext": "js", "max_stars_repo_path": "api/index.js", "max_stars_repo_name": "NaturallyAsh/OCR-Translator", "max_stars_repo_stars_event_min_datetime": "2020-05-26T06:02:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-02T19:55:43.000Z", "max_issues_repo_path": "api/index.js", "max_issues_repo_name": "NaturallyAsh/OCR-Translator", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "api/index.js", "max_forks_repo_name": "NaturallyAsh/OCR-Translator", "max_forks_repo_forks_event_min_datetime": "2018-07-06T17:33:20.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-02T23:56:40.000Z"}
{"max_stars_count": 8, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 22.2272727273, "max_line_length": 71, "alphanum_fraction": 0.6390593047}
'use strict';
var express = require('express');
var bP = require('body-parser');

var routes = require('./api/routes/translateRoutes');
var text = require('./api/models/textModel');
var status = require('./api/models/statusModel');


var app = express();

var server = app.listen(process.env.PORT || 3000, function () {
    var host = server.address().address;
    host = (host === '::' ? 'localhost' : host);
    var port = server.address().port;

    console.log('Listening at: http://%s:%s', host, port);

});


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

// to allow CORS
app.all('/*', function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "X-Requested-With");
  res.header("Access-Control-Allow-Headers", "Content-Type");
  next();
});


routes(app);



/** Error handling **/

app.use(function(req, res) {
  res.status(404).send({error: 'Url not found!', url: req.originalUrl})

});
