{"size": 1284, "ext": "js", "max_stars_repo_path": "server/index.js", "max_stars_repo_name": "rockingrohit9639/project-zone", "max_stars_repo_stars_event_min_datetime": "2021-06-07T08:01:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:22:51.000Z", "max_issues_repo_path": "server/index.js", "max_issues_repo_name": "rockingrohit9639/project-zone", "max_issues_repo_issues_event_min_datetime": "2021-06-03T15:17:22.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-10T14:42:14.000Z", "max_forks_repo_path": "server/index.js", "max_forks_repo_name": "rockingrohit9639/project-zone", "max_forks_repo_forks_event_min_datetime": "2021-05-28T16:35:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-09T14:15:20.000Z"}
{"max_stars_count": 31, "max_issues_count": 196, "max_forks_count": 77, "avg_line_length": 26.75, "max_line_length": 70, "alphanum_fraction": 0.6534267913}
const express = require("express");
const cors = require("cors");
const dotenv = require("dotenv");
const morgan = require("morgan");
const swaggerJsDoc = require("swagger-jsdoc");
const swaggerUi = require("swagger-ui-express");

const swaggerOptions = {
  definition: {
    openapi: "3.0.0",
    info: {
      title: "Project Zone API",
      version: "1.0.0",
      description: "Project Zone API created with NodeJs & ExpressJs",
    },
    servers: [
      {
        url: "https://project-zone-server.azurewebsites.net",
      },
    ],
  },
  apis: ["./routes/*.js"],
};

const swaggerDocs = swaggerJsDoc(swaggerOptions);

dotenv.config({ path: "config/config.env" });
const PORT = process.env.PORT || 8001;

const app = express(); // create express app
// app.use(morgan("tiny"));
app.use(cors());
app.use(express.json({ limit: "25mb" }));
app.use(express.urlencoded({ limit: "25mb", extended: true }));

require("./db/connection");

app.use(require("./routes/projectRoutes"));
app.use(require("./routes/authRoutes"));
app.use(require("./routes/ProtectedRoutes"));

app.use("/", swaggerUi.serve, swaggerUi.setup(swaggerDocs));

// start express server on port 3001 or process.env.PORT
app.listen(PORT, () =>
  console.log(`Server running on port http://localhost:${PORT}/`)
);
