<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Expressjs on Ulis Notizen</title>
    <link>https://wolf-u.li/tag/expressjs/</link>
    <description>Recent content in Expressjs on Ulis Notizen</description>
    <generator>Hugo</generator>
    <language>de</language>
    <copyright>Copyright 2006-CURRENTYEAR Uli Wolf - All rights reserved</copyright>
    <lastBuildDate>Sat, 26 Oct 2013 20:48:35 +2600</lastBuildDate>
    <atom:link href="https://wolf-u.li/tag/expressjs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Ausgabe der aktuellen routes von expressjs</title>
      
      
      <link>https://wolf-u.li/ausgabe-der-aktuellen-routes-von-expressjs/</link>
      <pubDate>Sat, 26 Oct 2013 20:48:35 +2600</pubDate>
      <guid>https://wolf-u.li/ausgabe-der-aktuellen-routes-von-expressjs/</guid>
      <description>&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;app&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;require&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;../app&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;console&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;log&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;app&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;routes&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;all&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;().&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;forEach&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;route&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;){&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; &lt;span class=&#34;nx&#34;&gt;console&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;log&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39; \033[90m%s \033[36m%s\033[0m&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;route&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;method&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;toUpperCase&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(),&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;route&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;path&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;console&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;log&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;process&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;exit&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;link rel=dns-prefetch href=//gist.github.com /&gt; &lt;a href=&#34;https://gist.github.com/1288766&#34;
    title=&#34;Quelle&#34; 
     target=&#34;_blank&#34; rel=&#34;nofollow noopener noreferrer&#34; &gt;
  Quelle&amp;nbsp;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; class=&#34;icon&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34; viewBox=&#34;0 -128 512 640&#34;&gt;
    &lt;path d=&#34;M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z&#34;/&gt;
  &lt;/svg&gt;&lt;/a&gt;&lt;/p&gt;</description>
      
         <content:encoded><![CDATA[<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">app</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../app&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">routes</span><span class="p">.</span><span class="nx">all</span><span class="p">().</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">route</span><span class="p">){</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39; \033[90m%s \033[36m%s\033[0m&#39;</span><span class="p">,</span> <span class="nx">route</span><span class="p">.</span><span class="nx">method</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">(),</span> <span class="nx">route</span><span class="p">.</span><span class="nx">path</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"><span class="nx">process</span><span class="p">.</span><span class="nx">exit</span><span class="p">();</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p><link rel=dns-prefetch href=//gist.github.com /> <a href="https://gist.github.com/1288766"
    title="Quelle" 
     target="_blank" rel="nofollow noopener noreferrer" >
  Quelle&nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="icon" aria-hidden="true" focusable="false" viewBox="0 -128 512 640">
    <path d="M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z"/>
  </svg></a></p>
]]></content:encoded>
    </item>
    <item>
      <title>NodeJS: Twitter Bootstrap alerts in ExpressJS einbinden mit express-messages-bootstrap</title>
      
      
      <link>https://wolf-u.li/nodejs-twitter-bootstrap-alerts-in-expressjs-einbinden-mit-express-messages-bootstrap/</link>
      <pubDate>Fri, 16 Mar 2012 13:13:01 +1600</pubDate>
      <guid>https://wolf-u.li/nodejs-twitter-bootstrap-alerts-in-expressjs-einbinden-mit-express-messages-bootstrap/</guid>
      <description>&lt;p&gt;Momentan experimentiere ich mit NodeJS herum und teste dabei wie man am schnellsten eine schöne Seite produziert. Ich bin dabei auf &lt;link rel=dns-prefetch href=//twitter.github.com /&gt; &lt;a href=&#34;http://twitter.github.com/bootstrap/&#34;
    title=&#34;Twitter Bootstrap&#34; 
     target=&#34;_blank&#34; rel=&#34;nofollow noopener noreferrer&#34; &gt;
  Twitter Bootstrap&amp;nbsp;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; class=&#34;icon&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34; viewBox=&#34;0 -128 512 640&#34;&gt;
    &lt;path d=&#34;M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z&#34;/&gt;
  &lt;/svg&gt;&lt;/a&gt; gestoßen, was eine Kombination von CSS-Eigenschaften und Javascripts darstellt, welche es erlauben schnell ein Layout zu erstellen. Zudem bietet dieses Framework auch vorgefertigte &lt;link rel=dns-prefetch href=//twitter.github.com /&gt; &lt;a href=&#34;http://twitter.github.com/bootstrap/components.html#alerts#alerts&#34;
    title=&#34;Alerts&#34; 
     target=&#34;_blank&#34; rel=&#34;nofollow noopener noreferrer&#34; &gt;
  Alerts&amp;nbsp;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; class=&#34;icon&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34; viewBox=&#34;0 -128 512 640&#34;&gt;
    &lt;path d=&#34;M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z&#34;/&gt;
  &lt;/svg&gt;&lt;/a&gt;, die dem User Nachrichten deutlich anzeigen können:&lt;/p&gt;</description>
      
         <content:encoded><![CDATA[<p>Momentan experimentiere ich mit NodeJS herum und teste dabei wie man am schnellsten eine schöne Seite produziert. Ich bin dabei auf <link rel=dns-prefetch href=//twitter.github.com /> <a href="http://twitter.github.com/bootstrap/"
    title="Twitter Bootstrap" 
     target="_blank" rel="nofollow noopener noreferrer" >
  Twitter Bootstrap&nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="icon" aria-hidden="true" focusable="false" viewBox="0 -128 512 640">
    <path d="M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z"/>
  </svg></a> gestoßen, was eine Kombination von CSS-Eigenschaften und Javascripts darstellt, welche es erlauben schnell ein Layout zu erstellen. Zudem bietet dieses Framework auch vorgefertigte <link rel=dns-prefetch href=//twitter.github.com /> <a href="http://twitter.github.com/bootstrap/components.html#alerts#alerts"
    title="Alerts" 
     target="_blank" rel="nofollow noopener noreferrer" >
  Alerts&nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="icon" aria-hidden="true" focusable="false" viewBox="0 -128 512 640">
    <path d="M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z"/>
  </svg></a>, die dem User Nachrichten deutlich anzeigen können:</p>
<p><img src="/upload/2012/03/4486-twitter-bootstrap-express.webp" alt="Twitter Bootstrap alerts in ExpressJS" loading="lazy" title="Twitter Bootstrap alerts in ExpressJS"></p>
<p>Gerne wollte ich dies nun in dem MVC-Framework <link rel=dns-prefetch href=//expressjs.com /> <a href="http://expressjs.com/guide"
    title="ExpressJS" 
     target="_blank" rel="nofollow noopener noreferrer" >
  ExpressJS&nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="icon" aria-hidden="true" focusable="false" viewBox="0 -128 512 640">
    <path d="M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z"/>
  </svg></a> verwenden, sodass ich daraus direkt die Alerts erstellen kann. Hierzu habe ich <link rel=dns-prefetch href=//github.com /> <a href="https://github.com/JasonGiedymin/express-messages-bootstrap"
    title="express-messages-bootstrap" 
     target="_blank" rel="nofollow noopener noreferrer" >
  express-messages-bootstrap&nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="icon" aria-hidden="true" focusable="false" viewBox="0 -128 512 640">
    <path d="M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z"/>
  </svg></a> (NPM: express-messages-bootstrap) entdeckt. Seit gestern kann dieses auch mit Twitter bootstrap 2.0 umgehen, welches vor kurzem released wurde. Mit einem <link rel=dns-prefetch href=//github.com /> <a href="https://github.com/JasonGiedymin/express-messages-bootstrap/pull/9"
    title="pull request von mir" 
     target="_blank" rel="nofollow noopener noreferrer" >
  pull request von mir&nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="icon" aria-hidden="true" focusable="false" viewBox="0 -128 512 640">
    <path d="M384 320c-17.67 0-32 14.33-32 32v96H64V160h96c17.67 0 32-14.32 32-32s-14.33-32-32-32L64 96c-35.35 0-64 28.65-64 64V448c0 35.34 28.65 64 64 64h288c35.35 0 64-28.66 64-64v-96C416 334.3 401.7 320 384 320zM488 0H352c-12.94 0-24.62 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.88L370.8 96L169.4 297.4c-12.5 12.5-12.5 32.75 0 45.25C175.6 348.9 183.8 352 192 352s16.38-3.125 22.62-9.375L416 141.3l41.38 41.38c9.156 9.141 22.88 11.84 34.88 6.938C504.2 184.6 512 172.9 512 160V24C512 10.74 501.3 0 488 0z"/>
  </svg></a> habe ich zudem angeregt, mehrere flash messages voneinander sauber zu trennen (siehe oben). Mal sehen ob dieser angenommen wird.</p>
<p>Wenn man das nun verwenden will, so muss man es zunächst per npm installieren:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm install express-messages
</span></span></code></pre></td></tr></table>
</div>
</div><p>Und anschließend in der Express-Configuration einbinden:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line"><span class="cl">app.dynamicHelpers({ messages: require(&#39;express-messages-bootstrap&#39;) });
</span></span></code></pre></td></tr></table>
</div>
</div><p>Nun muss man es noch im Template einbinden:</p>
<p><em>EJS</em>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="o">&lt;%-</span> <span class="nx">messages</span><span class="p">()</span> <span class="o">%&gt;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p><em>Jade</em>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="o">!=</span> <span class="nx">messages</span><span class="p">()</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>Alerts erstellt man im Controller wie folgt:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">req</span><span class="p">.</span><span class="nx">flash</span><span class="p">(</span><span class="s1">&#39;error&#39;</span><span class="p">,</span> <span class="s1">&#39;Dies ist ein Test mit Typ error&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">req</span><span class="p">.</span><span class="nx">flash</span><span class="p">(</span><span class="s1">&#39;info&#39;</span><span class="p">,</span> <span class="s1">&#39;Dies ist ein Test mit Typ info&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">req</span><span class="p">.</span><span class="nx">flash</span><span class="p">(</span><span class="s1">&#39;warning&#39;</span><span class="p">,</span> <span class="s1">&#39;Dies ist ein Test mit Typ warning&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">req</span><span class="p">.</span><span class="nx">flash</span><span class="p">(</span><span class="s1">&#39;success&#39;</span><span class="p">,</span> <span class="s1">&#39;Dies ist ein Test mit Typ success&#39;</span><span class="p">);</span><span class="sb">`
</span></span></span></code></pre></td></tr></table>
</div>
</div>]]></content:encoded>
    </item>
  </channel>
</rss>
