Posts

date.js exports method

  exports . getDate =   function (){ const  today  =   new   Date ();      //const containing new date const  options = {              // const containing the object of  what of the date is shown and in which data type   weekday: "long" ,   day: "numeric" ,   month: "long" ,   year: "numeric" } return  today. toLocaleDateString ( "en-US" ,options);   //converts the date to render the string representation of the date    }; exports . getDay = function (){      const  today  =   new   Date ();      //const containing new date      const  options = {...

footer.ejs

  </ body > < footer >     < h3 > &copy; Mohd Mehran Siddiqui</ h3 > </ footer > </ html >

header .ejs

  <! DOCTYPE   html > < html   lang = "en"   dir = "ltr" > < head >   < meta   charset = "utf-8" >   < title >To do List</ title >   < link   rel = "stylesheet"   href = "css/styles.css" > </ head > < body >

list .ejs

  <%-   include ( "header" )  -%>     < div   class = "box"   id = "heading" >     < h1 >  <%=  listTitle  %>  </ h1 >   </ div >   < div   class = "box" >      <%   for  ( var  i  =   0 ; i < newListItems.length; i ++ ){  %>     < div   class = "item" >       < input   type = "checkbox" >       < p >  <%=  newListItems[i]  %>  </ p >     </ div >      <%  }  %>     < form   class = "item"   action = "/"   method = "post" >       < input   type = "text"   name = "newItem"   placeholder = "...

to do list js

  const   express   =   require ( "express" ); const   bodyParser   =   require ( "body-parser" ); const  date  =   require (__dirname + "/date.js" ); const  app  =   express (); app. set ( 'view engine' ,  'ejs' );   //incorporates ejs with express app. use ( express . urlencoded ({extended: true }));   // express is used as body parse is depreceated app. use ( express . static ( "public" ));    //incorporates static files such as css to website const  items  =  [ "Buy Food" , "Cook Food" , "Eat Food" ]; const  workItems = []; app. get ( "/" , ( req ,  res )  =>  {    const  day  =  date. getDay ();      res . render ( "list" , {    // renders the templa...