{"size": 732, "ext": "js", "max_stars_repo_path": "src/server.js", "max_stars_repo_name": "Mhsalameh/auth-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/server.js", "max_issues_repo_name": "Mhsalameh/auth-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/server.js", "max_forks_repo_name": "Mhsalameh/auth-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.8536585366, "max_line_length": 51, "alphanum_fraction": 0.6461748634}
'use strict';
const express = require('express');
const authModel = require('./auth/router.js')
const serverError=require('./middleware/500.js')
const notFound = require('./middleware/404.js')
const cors = require('cors')
const app = express();
const v1 = require("./routes/v1.js");
const v2 = require("./routes/v2.js");


app.use(express.json());
app.use(cors())

app.use('/api/v1',v1);
app.use('/api/v2',v2);
app.use(authModel);

app.get('/',homeHandler)

function homeHandler(req,res){
    res.status(200).send("HOME!")
}




app.use('*',notFound)
app.use(serverError)


function start (port){
    app.listen(port,()=>{
        // console.log(`listening to port ${port}`)
    })
}

module.exports={
    app:app,
    start:start
}