{"size": 1109, "ext": "js", "max_stars_repo_path": "server/src/app.js", "max_stars_repo_name": "heardofdezz/HYPERTUBE", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/src/app.js", "max_issues_repo_name": "heardofdezz/HYPERTUBE", "max_issues_repo_issues_event_min_datetime": "2021-09-02T12:02:46.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-07T10:17:59.000Z", "max_forks_repo_path": "server/src/app.js", "max_forks_repo_name": "heardofdezz/Hypertube", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 27.0487804878, "max_line_length": 99, "alphanum_fraction": 0.69251578}
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const morgan = require('morgan');
const mongoose = require('mongoose');
const  Config = require('./config/Config')
const app = express();
const importMovies = require('./config/setup');
const movieRouter = require('./routers/movie');
const commentRouter = require('./routers/comment');

app.use(morgan('combined'));
app.use(bodyParser.json());
app.use(cors());


// Application routes
require('./routes')(app)

// Connecting to Mongo Database when connected then launching back-end Server
mongoose.connect('mongodb+srv://hypertube:' +
Config.db.password +
'@cluster0-ybiyr.mongodb.net/test?retryWrites=true&w=majority',
{
    useNewUrlParser: true,
    useUnifiedTopology: true
}).then((serverlaunch) => {

    //importMovies();
    app.use(movieRouter);
    app.use(commentRouter);
    app.listen(Config.port, () =>  {
        console.log(`listening server side on ${Config.port} Connected to Mongo/Mongoose Database`)
    })
}).catch((err) => {
    console.log(err)
});

/// Connect to app routes

