const express = require('express')  ;
const app = express();
const port = 3000;
const config = require('./config/config');
const format = require('./app/format');

app.get('/', (request, response) => {
    const currentDate = new Date();
    const data = format.timeObject().hours(config.open,config.close).appendMinutes(config.minutesInterval).cutOffHistory(currentDate).valueOf();
    response.send('x = ' + JSON.stringify(data,null,2));
});

app.listen(port, (err) => {
    if (err) {
        return console.log('something bad happened', err)
    }
    console.log(`server is listening on ${port}`)
});