-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
54 lines (45 loc) · 1.24 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const express= require("express")
const path = require("path")
const conn = require("./controllers/db")
const uploader = require("express-fileupload")
const app = express()
const router = require('./routes/main.routes')
const comments = require('./controllers/comments')
const { config, engine} = require("express-edge")
config({ cache: process.env.NODE_ENV === 'production'})
//path to static file
app.use(express.static(path.join(__dirname,"/public/")))
//middleware
app.use(router)
app.use(uploader())
app.use(engine)
global.conn = conn
app.set("views", __dirname+"/views")
//basic site info
var site = {
title : "ExpD:: Explorers & Developers",
subtitle: "Yes, WE Can",
site: "expd.co.ke",
author:{
name : "Wachiye Jeremiah Siranjofu",
emailLink :"mailto:[email protected]?Subject=ExpD::Contact",
email:"[email protected]"
},
loggedIn : false,
user :{
id : undefined,
username : undefined,
fullname: undefined,
email: undefined,
category: undefined,
role: undefined
},
unread : 0
}
global.info = site
//index route
app.get("/", (req,res) =>{
res.render("index",{info,all})
})
//port accessibility
app.listen( process.env.PORT || 3000 )