Skip to content

Commit 7ccc119

Browse files
committedJan 23, 2024
add the uuid module and set up the list to act as a database with default entries
1 parent fbe0f0c commit 7ccc119

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed
 

‎index.js

+19
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import express from "express" ;
55

66
import bodyParser from "body-parser" ;
77

8+
import { v4 as todoID } from 'uuid' ;
9+
810
// initialize application using express
911

1012
const app = express () ;
@@ -17,6 +19,23 @@ app .set ( "view engine" , "ejs" ) ;
1719

1820
const port = 3000 ;
1921

22+
// setup the list to act as a database and enter some default contents
23+
24+
let todos = [
25+
26+
{
27+
id : todoID () ,
28+
29+
name : "Go to the gym" ,
30+
31+
about : "Start with a warm-up, followed by stretching exercises and then move on to strength training, mobility work and cardio."
32+
33+
} ,
34+
35+
] ;
36+
37+
console .log ( todos ) ;
38+
2039
// configure the todos page/homepage
2140

2241
app .get (

‎package-lock.json

+14-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"body-parser": "^1.20.2",
1414
"ejs": "^3.1.9",
15-
"express": "^4.18.2"
15+
"express": "^4.18.2",
16+
"uuid": "^9.0.1"
1617
}
1718
}

0 commit comments

Comments
 (0)
Please sign in to comment.