Created
May 8, 2022 06:33
-
-
Save peterkarn/087b4dcabdcabfe6ec6a8dddf44dc09a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.set('view engine', 'ejs'); | |
app.listen(3000, () => { | |
console.log('app on port 3000'); | |
}) | |
app.get('/', (req, res) => { | |
let today = new Date(); | |
let dateFromBackend = new Date(today); | |
const options = { | |
templateDate: dateFromBackend, | |
} | |
res.render('index', options); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment