Created
March 31, 2024 14:54
-
-
Save Kernix13/e2ad135c65c87ca889092ff2a658d2e6 to your computer and use it in GitHub Desktop.
EJS views and first basic route (Node and Express.js)
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
// add to app.js | |
const path = require('path'); | |
/* Set EJS as the view engine */ | |
app.set('view engine', 'ejs'); | |
app.set('views', path.join(__dirname, 'views')); | |
// change res.send to res.render | |
app.get('/', (req, res) => { | |
res.render('home'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment