-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
50 lines (37 loc) · 945 Bytes
/
Copy pathserver.js
File metadata and controls
50 lines (37 loc) · 945 Bytes
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
// Begin with the imported modules needed; express to build the server; ejs to make the templates
// Need a port, and then need to set up the path to the assets (where the static files will be).
const express = require("express");
const ejs = require("ejs");
const path = require("path");
const port = process.env.PORT || '3000';
const admin = require("./admin");
// app configuration
const app = express();
app.use(express.static(path.join(__dirname, "assets")));
app.set('view engine', 'ejs');
app.use(express.urlencoded({extended: false}));
/**
* USE USER ADMIN ROUTES HERE
*/
app.use("/admin", admin);
/**
* GET ROUTES
*/
app.get("/", (req, res )=>{
res.render("index");
})
app.get("/admin", (req, res)=>{
res.render("adminLogin");
})
/**
* POST ROUTES
*/
/**
* Server Activation
*/
module.exports = {
app,
}
app.listen(port, () => {
console.log(`Listening to requests on http://localhost:${port}`);
});