forked from rashimotwani/IITISoC-22-Web-3-GameOfLife
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
59 lines (34 loc) · 1.01 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
54
55
56
57
58
59
const express=require("express");
const bodyParser=require("body-parser");
const mongoose= require("mongoose");
const app=express();
app.use(bodyParser.urlencoded({extended:true}));
app.use(express.static("public"));
app.set("view engine","ejs");
const DB="mongodb+srv://mongo:Delhi%[email protected]/lifeDB"
mongoose.connect(DB,{useNewUrlParser: true});
const lifeSchema=new mongoose.Schema ({
cells:Array,
});
// const LifeCollection = mongoose.model("LifeCollection",lifeSchema);
// const data1 = new LifeCollection ({
// cells:cellsa,
// });
// data1.save();
app.get("/",function(req,res){
var today=new Date();
// LifeCollection.find({}, function(err,docs){
// if(err){console.log("hero");}
// else{console.log(docs);}
// });
// console.log(cells);
res.render("index2",{EJS:today});
});
app.get("/about",function(req,res){
res.render("about");
});
app.listen(process.env.PORT || 4000, function()
{
console.log("server is running on port 3000");
}
);