Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <%- include myview.ejs %>
  2.  
  3. var path = require('path');
  4.  
  5. // Set the default templating engine to ejs
  6. app.set('view engine', 'ejs');
  7. app.set('views', path.join(__dirname, 'views'));
  8.  
  9. // The views/index.ejs exists in the app directory
  10. app.get('/hello', function (req, res) {
  11. res.render('index', {title: 'title'});
  12. });
  13.  
  14. <%- include partials/navigation.ejs %>
  15.  
  16. <ul><li class="active">...</li>...</ul>
  17.  
  18. var path = require('path');
  19. var EJS = require('ejs');
  20.  
  21. app.engine('html', EJS.renderFile);
  22.  
  23. // Set the default templating engine to ejs
  24. app.set('view engine', 'ejs');
  25. app.set('views', path.join(__dirname, 'views'));
  26.  
  27. // The views/index.html exists in the app directory
  28. app.get('/hello', function (req, res) {
  29. res.render('index.html', {title: 'title'});
  30. });
  31.  
  32. var EJSLayout = require('express-ejs-layouts');
  33. app.use(EJSLayout);
  34.  
  35. // above is all your node requires
  36.  
  37. // view engine setup
  38. app.set('views', path.join(__dirname, 'views')); <-- ./views has all your .ejs files
  39. app.set('view engine', 'ejs');
  40.  
  41. <!-- because ejs knows your root directory for views, you can navigate to the ./base directory and select the header.ejs file and include it -->
  42.  
  43. <% include ./base/header %>
  44. <h1> Other mark up here </h1>
  45. <% include ./base/footer %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement