To do list (Algo)

 Algorithm for to do list:

Step:

1: In terminal initialize npm and install express,body-parse, and ejs.

2: in editor incorporate body-parser and express.

3: Bind express to a constant app

4: Using app.set incorporate ejs with express.

                     app.set("view engine", "ejs);

5:using app .use incorporate body-parser(now depreceated), so we can use express instead.

6:using app.get define route and has a call back which will hold the data of get.

    6a: inside call back:-

            6a1: create a variable for date 

            6a2: create an object which will contain the date day month and year to be displayed.

            6a3:create a variable which will convert the date toLocaleDateString (Date string)

7: using res.render, render the template (list) and items to send to the client.

8: using app.post on the home route and a call back including the input grab from webpage , pushing the grabbed element to array which is to be created above app.get, and redirecting to home after updating the webpage list.

9: app.listen to set server at a port usually 3000 and a callback logging that server has started a specified port.

Comments

Popular posts from this blog

To read data from database using mongo driver

To do list (without styling and css)

Template, layout and scope