-
Notifications
You must be signed in to change notification settings - Fork 21
/
app.js
53 lines (46 loc) · 1.41 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require("dotenv").config();
const express = require("express");
const app = express();
const expressLayouts = require("express-ejs-layouts");
defaultProfile = {
avatar: "https://avatars.githubusercontent.com/u/42767012?v=4",
username: "iampavangandhi",
name: "Pavan Gandhi",
public_repos: "92",
repo_stars: "517",
repo_forks: "377",
followers: "165",
user_orgs: "6",
score: "9915",
url: "https://github.com/iampavangandhi",
};
// Body parser
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
// EJS Middleware
app.set("view engine", "ejs");
app.set("views", __dirname + "/views");
app.set("layout", "layouts/layout");
app.use(expressLayouts);
app.use(express.static("public"));
// Include Routes
const indexRouter = require("./routes/index");
const profileRouter = require("./routes/profile");
const compareRouter = require("./routes/compare");
const badgeRouter = require("./routes/badge");
const apiRouter = require("./routes/api");
const topRouter = require("./routes/top");
const NullRouter = require("./routes/null");
// Use Routes
app.use("/", indexRouter);
app.use("/profile", profileRouter);
app.use("/compare", compareRouter);
app.use("/badge", badgeRouter);
app.use("/api", apiRouter);
app.use("/top", topRouter);
app.use("/NULL", NullRouter);
const PORT = process.env.PORT || 3000;
// Server
app.listen(PORT, () => {
console.log(`Server is up and running at Port: ${PORT}`);
});