Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I checked in the express source code and the <code>app.set</code> function simply assigns over top of any previous value it had. To get the behavior you're looking for you'll have to merge the <code>view options</code> object in subsequent calls. This means you'll probably have to jump through a couple of hoops. The connect package has a merge function that will work for this but to get it you'll have to include it in your <code>package.json</code>:</p> <pre><code>"dependencies": { "express": "2.5.5" , "jade": "&gt;= 0.0.1" , "connect": "1.X" } </code></pre> <p>You'll need to get the <code>utils</code> object from connect:</p> <pre><code>var utils = require('connect').utils; </code></pre> <p><code>app.set(option)</code> with no value returns the current setting for the option so the second time you set <code>view option</code> you could do it this way:</p> <pre><code>app.set('view options', utils.merge(app.set('view options'), { pretty: true })); </code></pre> <p>As for the problem you're having with the logger, remember that app.use is adding pieces of middleware to a stack. As a request is being processed it calls each piece of middleware in the order they are originally configured and sometimes if a piece of middleware is able to fulfill its duty it will not pass control to subsequent middleware in the stack.</p> <p>This is the case with the <code>router</code> middleware when it fulfills a request for the <code>'/'</code> url where <code>logger</code> is not subsequently run. The reason the request for <code>favicon.ico</code> shows up in the log stream is that none of the middleware was able to fulfill it (the <code>static</code> middleware would if you had a <code>public/favicon.ico</code> file) and processing falls through to the <code>logger</code> middleware.</p> <p>To make your example work you'll need to define the <code>logger</code> middleware earlier in your stack, before the <code>router</code> middleware.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload