-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapp.js
34 lines (31 loc) · 856 Bytes
/
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
const express = require("express")
const path = require('path');
const app = express();
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(express.static(path.join(__dirname, 'node_modules')));
app.use(express.static(path.join(__dirname, 'public')));
var port = 3000;
app.get("/", function(req,res){
// res.render("admin_login");
res.render("admin-login");
});
app.get("/admin_login", function(req,res){
res.render("admin-login");
});
app.get("/admin_in", function(req,res){
var Name = req.query.name;
var Password = req.query.pass;
if (Password =="123")
{
console.log("Successfully logged in as admin");
res.render("admin");
}
else{
res.render("notfound.ejs");
}
});
var server = app.listen(port, function () {
console.log("Server listening on " + port);
})
module.exports.app = app;