question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document express usage

See original GitHub issue

Allow ‘root’ opt passed in data

var _OPTS = ['delimiter', 'scope', 'context', 'debug', 'compileDebug',
  'client', '_with', 'rmWhitespace', 'strict', 'filename',
  'root'
];

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
mdecommented, Jan 22, 2017

Thank you so much for unraveling this! We need to add this to docs, so other people know how to do bespoke config for EJS using Express.

2reactions
nwoltmancommented, Jan 22, 2017

Actually, I can pass in options to EJS by using a custom render function with Express:

const app = express();
const ejsOptions = {
  cache: app.get('view cache'),
  root: '/path/to/views',
};

app.engine('ejs', (path, data, cb) => {
  ejs.renderFile(path, data, ejsOptions, cb);
});

This solves my problem and is probably the best way to configure EJS with Express rather than setting the completely undocumented 'view options' setting on the app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Document an Express API with Swagger UI and JSDoc
An Express-based REST API running on a local Express server. If you don't have one, you can install the Express API used in...
Read more >
Express documentation — DevDocs
This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.
Read more >
Meet MHC Document Express
Document Express automates routine tasks, making them easier, more efficient and stress free. It integrates out-of-the-box with your existing ERP and other ...
Read more >
Guidelines for Using Doc Express
INTRODUCTION. The following guidelines discuss the workflow and for documents and correspondence submitted and stored in Doc Express.
Read more >
API Reference - Express 4.x
express () Creates an Express application. The express() function is a top-level function exported by the express module.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found