Skip to content

Commit bd16f28

Browse files
committed
added To Do List
1 parent d002a33 commit bd16f28

File tree

14 files changed

+797
-0
lines changed

14 files changed

+797
-0
lines changed

todolist/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
node_modules/

todolist/Readme.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<h1>To Do List</h1>
2+
3+
<p>To Do list made using HTML, CSS,JS and Node.js.</p>
4+
5+
### To Do List :
6+
7+
<p>This app allows you to make a list of events you want to do and you can strikeout the events completed.</p>
8+
9+
<h3>Used Technologies</h3>
10+
<ul>
11+
<li>HTML5</li>
12+
<li>CSS3</li>
13+
<li>JavaScript</li>
14+
<li>Node.js</li>
15+
</ul>
16+
17+
#### Steps to Use:
18+
19+
---
20+
* Download [Node Js and npm(Node package manager)](https://nodejs.org/en/) (when you install Node, npm also gets installed by default)
21+
<br/>
22+
23+
* Clone the repository by running command
24+
```
25+
git clone https://github.com/Ayushparikh-code/Web-dev-mini-projects.git
26+
```
27+
in your git bash.
28+
<br/>
29+
30+
* Run command `cd todolist`.
31+
<br/>
32+
33+
* Run this command to install all dependencies for the project.
34+
```
35+
npm install
36+
```
37+
*Run this command to run the file.
38+
```
39+
node app.js
40+
```
41+
* Open http://localhost:3000/ on your browser.
42+
<br/>
43+
44+
<h3>ScreenShots</h3>
45+
<br>
46+
![main](images/main.PNG)
47+
![work](images/work.PNG)

todolist/app.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//jshint esversion:6
2+
3+
const express = require("express");
4+
const bodyParser = require("body-parser");
5+
const date = require(__dirname + "/date.js");
6+
7+
const app = express();
8+
9+
app.set('view engine', 'ejs');
10+
11+
app.use(bodyParser.urlencoded({extended: true}));
12+
app.use(express.static("public"));
13+
14+
const items = [];
15+
const workItems = [];
16+
17+
app.get("/", function(req, res) {
18+
19+
const day = date.getDate();
20+
21+
res.render("list", {listTitle: day, newListItems: items});
22+
23+
});
24+
25+
app.post("/", function(req, res){
26+
27+
const item = req.body.newItem;
28+
29+
if (req.body.list === "Work") {
30+
workItems.push(item);
31+
res.redirect("/work");
32+
} else {
33+
items.push(item);
34+
res.redirect("/");
35+
}
36+
});
37+
38+
app.get("/work", function(req,res){
39+
res.render("list", {listTitle: "Work List", newListItems: workItems});
40+
});
41+
42+
app.get("/about", function(req, res){
43+
res.render("about");
44+
});
45+
46+
app.listen(3000, function() {
47+
console.log("Server started on port 3000");
48+
});

todolist/date.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//jshint esversion:6
2+
3+
exports.getDate = function() {
4+
5+
const today = new Date();
6+
7+
const options = {
8+
weekday: "long",
9+
day: "numeric",
10+
month: "long"
11+
};
12+
13+
return today.toLocaleDateString("en-US", options);
14+
15+
};
16+
17+
exports.getDay = function () {
18+
19+
const today = new Date();
20+
21+
const options = {
22+
weekday: "long"
23+
};
24+
25+
return today.toLocaleDateString("en-US", options);
26+
27+
};

todolist/images/main.PNG

20.8 KB
Loading

todolist/images/work.PNG

18.4 KB
Loading

todolist/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en" dir="ltr">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>To Do List</title>
6+
</head>
7+
<body>
8+
<h1>It's a weekday!</h1>
9+
<p>Why are you not working!</p>
10+
11+
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)