{"size": 1695, "ext": "js", "max_stars_repo_path": "src/server/index.js", "max_stars_repo_name": "PublicaIO/mvp", "max_stars_repo_stars_event_min_datetime": "2018-01-04T05:24:26.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-09T15:49:09.000Z", "max_issues_repo_path": "src/server/index.js", "max_issues_repo_name": "PublicaIO/mvp", "max_issues_repo_issues_event_min_datetime": "2018-01-12T17:15:37.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-12T17:28:19.000Z", "max_forks_repo_path": "src/server/index.js", "max_forks_repo_name": "PublicaIO/mvp", "max_forks_repo_forks_event_min_datetime": "2021-04-16T09:19:10.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-04T06:41:32.000Z"}
{"max_stars_count": 8, "max_issues_count": 6, "max_forks_count": 2, "avg_line_length": 31.9811320755, "max_line_length": 98, "alphanum_fraction": 0.7079646018}
require('dotenv').config();
const path = require('path');
const debug = require('debug')('express:view');
const express = require('express');
const passport = require('passport');
const session = require('express-session');
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser');
const favicon = require('serve-favicon');
const firebase = require('firebase');
const firebaseAdmin = require('firebase-admin');
const firebaseConfig = require(path.join(__dirname, '..', 'config', 'firebase'));
const firebaseAdminAccount = require(path.join(__dirname, '..', 'config', 'firebase-admin.json'));

firebase.initializeApp(firebaseConfig);

firebaseAdmin.initializeApp({
    credential: firebaseAdmin.credential.cert(firebaseAdminAccount),
    databaseURL: firebaseAdmin.databaseURL
});

const router = require('./router');
const responseMiddleware = require('./utils/response');
const app = express();

app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, '..', 'app', 'views'));
app.set('trust proxy', 1);

app.use(favicon(path.join(__dirname, '..', '..', 'public', 'favicon.ico')));
app.use(express.static('public'));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(responseMiddleware);

app.use(cookieParser('thisismysecret'));
app.use(session({
    secret: 'thisismysecret',
    resave: false,
    saveUninitialized: true,
    cookie: { secure: false }
}));

app.use(passport.initialize());
app.use(passport.session());

passport.serializeUser((user, done) => done(null, user));
passport.deserializeUser((user, done) => done(null, user));

app.use(router);

app.listen(3000, () => console.log('Listening on 3000'));
