{"size": 646, "ext": "js", "max_stars_repo_path": "server/app.js", "max_stars_repo_name": "52punk/Daily_Expense_Tracker", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/app.js", "max_issues_repo_name": "52punk/Daily_Expense_Tracker", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/app.js", "max_forks_repo_name": "52punk/Daily_Expense_Tracker", "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": 23.9259259259, "max_line_length": 107, "alphanum_fraction": 0.7089783282}
import express from "express";
const app = express();
import cors from "cors";
import bodyParser from "body-parser";
import mongoose from "mongoose";
import postRouter from "./routes/post.js";

// MIDDLEWARES

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

// ROUTES
app.use("/posts", postRouter);
// DATABASE CONNECTION

const CONNECTION_URL =
  "mongodb+srv://52punk:52punk2017@cluster0.b19hh.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
const PORT = 5000;

mongoose
  .connect(CONNECTION_URL)
  .then(() =>
    app.listen(PORT, () => console.log(`Server running at : ${PORT}`))
  )
  .catch((error) => console.log(error.message));
