├── Procfile ├── views ├── partials │ ├── footer.ejs │ └── header.ejs ├── contact.ejs ├── edit.ejs ├── new.ejs ├── show.ejs ├── landing.ejs ├── index.ejs └── cases.ejs ├── .gitattributes ├── public └── stylesheets │ ├── app.css │ └── landing.css ├── package.json └── app.js /Procfile: -------------------------------------------------------------------------------- 1 | web: node app.js 2 | -------------------------------------------------------------------------------- /views/partials/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /public/stylesheets/app.css: -------------------------------------------------------------------------------- 1 | i.icon { 2 | font-size: 1.5em; 3 | } 4 | 5 | .container.main { 6 | margin-top: 7.0em; 7 | } 8 | 9 | #delete { 10 | display: inline; 11 | } 12 | .fine{ 13 | border-radius:none; 14 | } 15 | select{ 16 | margin-bottom:1.5em; 17 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rahul_iet", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start":"node app.js" 9 | 10 | 11 | }, 12 | "author": "rahul", 13 | "license": "ISC", 14 | "dependencies": { 15 | "body-parser": "^1.19.0", 16 | "ejs": "^3.1.3", 17 | "express": "^4.17.1", 18 | "express-sanitizer": "^1.0.5", 19 | "method-override": "^3.0.0", 20 | "mongoose": "^5.9.19", 21 | "nodemon": "^2.0.4" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /views/contact.ejs: -------------------------------------------------------------------------------- 1 | <%- include('./partials/header') %> 2 |
3 |
Contact for help
4 |
5 |
6 | 7 | 8 |
9 |
10 | 11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 | 19 |
20 | 21 |
22 | <%- include('./partials/footer') %> -------------------------------------------------------------------------------- /views/edit.ejs: -------------------------------------------------------------------------------- 1 | <%- include('./partials/header') %> 2 |
3 |
Edit <%= blog.title %>
4 |
5 |
6 | 7 | 8 |
9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 | 18 |
19 |
20 | <%- include('./partials/footer') %> -------------------------------------------------------------------------------- /views/new.ejs: -------------------------------------------------------------------------------- 1 | <%- include('./partials/header') %> 2 |
3 |
New Blog/Article
4 |
5 |
6 | 7 | 8 |
9 |
10 | 11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 | 19 |
20 |
21 | <%- include('./partials/footer') %> -------------------------------------------------------------------------------- /views/show.ejs: -------------------------------------------------------------------------------- 1 | <%- include('./partials/header') %> 2 |
3 |
<%= blog.title %>
4 |
5 |
6 | 7 |
8 | <%= blog.created.toDateString() %> 9 |
10 |
11 |

<%- blog.body %>

12 |
13 | Edit 14 |
15 | 16 |
17 |
18 |
19 | 20 |
21 | <%- include('./partials/footer') %> -------------------------------------------------------------------------------- /views/landing.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IET 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |

IET-covidtracker

17 | Getstarted 18 |
19 | 20 | -------------------------------------------------------------------------------- /views/partials/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | IET 4 | 5 | 6 | 7 | 8 | 9 | 18 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /views/index.ejs: -------------------------------------------------------------------------------- 1 | <%- include('./partials/header') %> 2 | 3 |
4 | NEWPOST
5 |
Articles
6 |
7 |
8 | 9 | <% blogs.forEach(function(blog){ %> 10 |
11 |
12 | 13 |
14 |
15 | <%=blog.title%> 16 |
17 | <%= blog.created.toDateString() %> 18 |
19 |
20 |

<%= blog.body.substring(0, 100) %>...

21 |
22 | 28 |
29 |
30 | <% }) %> 31 |
32 |
33 |
34 | 35 | 36 | 37 | <%- include('./partials/footer') %> -------------------------------------------------------------------------------- /public/stylesheets/landing.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #000; 3 | } 4 | 5 | #landing-header { 6 | z-index: 1; 7 | position: relative; 8 | text-align: center; 9 | padding-top: 40vh; 10 | } 11 | 12 | #landing-header h1 { 13 | color: #fff; 14 | } 15 | 16 | .slideshow { 17 | position: fixed; 18 | width: 100%; 19 | height: 100%; 20 | top: 0; 21 | left: 0; 22 | z-index: 0; 23 | list-style: none; 24 | margin: 0; 25 | padding: 0; 26 | } 27 | 28 | .slideshow li { 29 | width: 100%; 30 | height: 100%; 31 | position: absolute; 32 | top: 0; 33 | left: 0; 34 | background-size: cover; 35 | background-position: 50% 50%; 36 | background-repeat: no-repeat; 37 | opacity: 0; 38 | z-index: 0; 39 | animation: imageAnimation 50s linear infinite; 40 | } 41 | 42 | .slideshow li:nth-child(1) { 43 | background-image: url(https://images.unsplash.com/photo-1587113020436-d7df11a08f8e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=60); 44 | 45 | 46 | } 47 | .slideshow li:nth-child(2) { 48 | background-image: url(https://images.unsplash.com/photo-1591724250115-907da4866fca?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=60); 49 | animation-delay: 10s; 50 | } 51 | .slideshow li:nth-child(3) { 52 | background-image: url(https://images.unsplash.com/photo-1588683023217-97e48b7da1a2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=60); 53 | animation-delay: 20s; 54 | } 55 | .slideshow li:nth-child(4) { 56 | background-image: url(https://images.unsplash.com/photo-1591903525958-cce615c2371f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=60); 57 | animation-delay: 30s; 58 | } 59 | .slideshow li:nth-child(5) { 60 | background-image: url(https://images.unsplash.com/photo-1591870036007-2d195e054914?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=60); 61 | animation-delay: 40s; 62 | } 63 | 64 | @keyframes imageAnimation { 65 | 0% { 66 | opacity: 0; 67 | animation-timing-function: ease-in; 68 | } 69 | 10% { 70 | opacity: 1; 71 | animation-timing-function: ease-out; 72 | } 73 | 20% { 74 | opacity: 1 75 | } 76 | 30% { 77 | opacity: 0 78 | } 79 | } 80 | 81 | 82 | .no-cssanimations .slideshow li { 83 | opacity: 1; 84 | } -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var bodyParser = require("body-parser"), 2 | methodOverride = require("method-override"), 3 | expressSanitizer = require("express-sanitizer"), 4 | mongoose = require("mongoose"), 5 | express = require("express"), 6 | app = express(); 7 | 8 | // APP 9 | mongoose.connect('mongodb+srv://rgtech:KtuWP5YbG2MUNpdl@cluster0.tuitl.mongodb.net/covid19?retryWrites=true&w=majority',{useNewUrlParser: true, useUnifiedTopology: true}); 10 | 11 | // mongoose.connect('mongodb://localhost:27017/IET_COVID_app', {useNewUrlParser: true, useUnifiedTopology: true}); 12 | app.set("view engine", "ejs"); 13 | app.use(express.static("public")); 14 | app.use(bodyParser.urlencoded({extended: true})); 15 | app.use(expressSanitizer()); 16 | app.use(methodOverride("_method")); 17 | 18 | 19 | var blogSchema = new mongoose.Schema({ 20 | title: String, 21 | image: String, 22 | body: String, 23 | created: {type: Date, default: Date.now} 24 | }); 25 | var contactSchema = new mongoose.Schema({ 26 | name:String, 27 | email:String, 28 | message:String 29 | }); 30 | 31 | var Contact=mongoose.model("Contact",contactSchema); 32 | var Blog = mongoose.model("Blog", blogSchema); 33 | 34 | 35 | 36 | 37 | 38 | 39 | app.get("/", function(req, res){ 40 | res.render("landing"); 41 | }); 42 | 43 | // INDEX 44 | app.get("/blogs", function(req, res){ 45 | Blog.find({}, function(err, blogs){ 46 | if(err){ 47 | console.log("ERROR!"); 48 | } else { 49 | res.render("index", {blogs: blogs}); 50 | } 51 | }); 52 | }); 53 | 54 | // NEW 55 | app.get("/blogs/new", function(req, res){ 56 | res.render("new"); 57 | }); 58 | 59 | // CREATE 60 | app.post("/blogs", function(req, res){ 61 | // create blog 62 | console.log(req.body); 63 | req.body.blog.body = req.sanitize(req.body.blog.body) 64 | console.log("===========") 65 | console.log(req.body); 66 | Blog.create(req.body.blog, function(err, newBlog){ 67 | if(err){ 68 | res.render("new"); 69 | } else { 70 | //then, redirect to the index 71 | res.redirect("/blogs"); 72 | } 73 | }); 74 | }); 75 | 76 | // SHOW ROUTE 77 | app.get("/blogs/:id", function(req, res){ 78 | Blog.findById(req.params.id, function(err, foundBlog){ 79 | if(err){ 80 | res.redirect("/blogs"); 81 | } else { 82 | res.render("show", {blog: foundBlog}); 83 | } 84 | }) 85 | }); 86 | 87 | // EDIT 88 | app.get("/blogs/:id/edit", function(req, res){ 89 | Blog.findById(req.params.id, function(err, foundBlog){ 90 | if(err){ 91 | res.redirect("/blogs"); 92 | } else { 93 | res.render("edit", {blog: foundBlog}); 94 | } 95 | }); 96 | }) 97 | 98 | 99 | // UPDATE 100 | app.put("/blogs/:id", function(req, res){ 101 | req.body.blog.body = req.sanitize(req.body.blog.body) 102 | Blog.findByIdAndUpdate(req.params.id, req.body.blog, function(err, updatedBlog){ 103 | if(err){ 104 | res.redirect("/blogs"); 105 | } else { 106 | res.redirect("/blogs/" + req.params.id); 107 | } 108 | }); 109 | }); 110 | 111 | app.delete("/blogs/:id", function(req, res){ 112 | Blog.findById(req.params.id, function(err, blog){ 113 | if(err){ 114 | console.log(err); 115 | } else { 116 | blog.remove(); 117 | res.redirect("/blogs"); 118 | } 119 | }); 120 | }); 121 | 122 | app.get("/cases",function(req,res){ 123 | res.render("cases"); 124 | }); 125 | 126 | app.get("/help",function(req,res){ 127 | res.render("contact"); 128 | }) 129 | 130 | app.post("/help",function(req,res){ 131 | console.log(req.body); 132 | Contact.create(req.body.contact,function(err){ 133 | if(err){ 134 | console.log(err); 135 | res.redirect("/help"); 136 | }else{ 137 | res.redirect("/blogs") 138 | } 139 | }) 140 | }) 141 | 142 | app.listen(process.env.PORT, process.env.IP, function(){ 143 | console.log("IET"); 144 | }); 145 | 146 | // app.listen(3000,function(){ 147 | // console.log("IET"); 148 | // }); 149 | -------------------------------------------------------------------------------- /views/cases.ejs: -------------------------------------------------------------------------------- 1 | <%- include('./partials/header') %> 2 |
3 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 |
State/UTConfirmedActiveRecoveredDeceased
Maharashtra1,32,07560,14765,7446,170
Delhi59,746 29 | 24,55833,0132,175
Tamil Nadu59,37725,86632,754757
Gujarat27,317 44 | 6,29619,3571,664
Uttar Pradesh17,7316,18610,995550
Rajasthan14,9972,99611,652349
West Bengal13,9455,0938,297555
Madhya Pradesh11,9032,3739,015515
Haryana10,7094,9915,557161
Andhra Pradesh9,3724,8264,435111
Karnataka9,1503,3915,618137
Bihar7,8082,1265,63151
Telangana7,8023,8613,731210
Jammu and Kashmir5,9562,4923,38282
Assam5,5862,1693,4059
Odisha5,3031,4193,86321
Punjab4,0741,2752,70099
Kerala3,1731,4901,65922
Uttarakhand2,4018481,51127
Chhattisgarh2,2558231,42111
Jharkhand2,0896721,40611
Tripura1,2244647591
Manipur841591250None
Ladakh8377021341
Goa8186821351
Himachal Pradesh7022634197
Chandigarh406843166
Puducherry3832181378
Nagaland280139141None
Mizoram14213012None
Total4,56,2961,81,9462,38,06713,745
241 | 242 |
243 | <%- include('./partials/footer') %> 244 | 245 | --------------------------------------------------------------------------------