Skip to content

Instantly share code, notes, and snippets.

@Kernix13
Created March 31, 2024 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kernix13/e2ad135c65c87ca889092ff2a658d2e6 to your computer and use it in GitHub Desktop.
Save Kernix13/e2ad135c65c87ca889092ff2a658d2e6 to your computer and use it in GitHub Desktop.
EJS views and first basic route (Node and Express.js)
// 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