For this website to work we have to incorporate multiple modules to make a single functioning websitt
Posts
date.js exports method
- Get link
- X
- Other Apps
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 = {...
list .ejs
- Get link
- X
- Other Apps
<%- 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
- Get link
- X
- Other Apps
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...