-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
36 lines (32 loc) · 989 Bytes
/
index.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
const express = require('express');
const cookieSession = require("cookie-session");
const bodyParser = require("body-parser");
const rateLimit = require("express-rate-limit");
const cors = require("cors");
const app = express();
const colorette = require("colorette")
const makeToken = require("./src/generator/token")
/* App Intilization */
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(
cookieSession({
name: "By Cheeini",
keys: ["follow", "Nicat-dcw"],
maxAge: 120 * 60 * 60 * 1000,
})
);
/*end*/
/* Connect To MongoDB */
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGODB_URL)
.then(() => console.log(`${colorette.green("CONNECTED TO MONGODB")}`));
app.use("/api", require("./src/routers/api.js"));
app.use("/admin",require("./src/routers/admin.js"))
app.get('/', (req, res) => {
res.send('Hello Express app!')
});
app.listen(3000, () => {
console.log('server started');
});