node-koa.json 2.5 KB

123456
  1. {
  2. "html": "<div class=\"section\" id=\"installation\">\n<h2>Installation</h2>\n<p>Raven is distributed via <code class=\"docutils literal\"><span class=\"pre\">npm</span></code>:</p>\n<div class=\"highlight-bash\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>$ npm install raven --save\n</pre></div>\n</div>\n</div>\n\n\n<div class=\"section\" id=\"koa\">\n<h2>Koa</h2>\n<div class=\"highlight-javascript\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">var</span> <span style=\"color: #111111\">koa</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #111111\">require(</span><span style=\"color: #e8535a\">&#39;koa&#39;</span><span style=\"color: #111111\">);</span>\n<span style=\"color: #2eb0f7\">var</span> <span style=\"color: #111111\">Raven</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #111111\">require(</span><span style=\"color: #e8535a\">&#39;raven&#39;</span><span style=\"color: #111111\">);</span>\n\n<span style=\"color: #2eb0f7\">var</span> <span style=\"color: #111111\">app</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #111111\">koa();</span>\n<span style=\"color: #111111\">Raven.config(</span><span style=\"color: #e8535a\">&#39;___DSN___&#39;</span><span style=\"color: #111111\">).install();</span>\n\n<span style=\"color: #111111\">app.on(</span><span style=\"color: #e8535a\">&#39;error&#39;</span><span style=\"color: #111111\">,</span> <span style=\"color: #2eb0f7\">function</span> <span style=\"color: #111111\">(err)</span> <span style=\"color: #111111\">{</span>\n <span style=\"color: #111111\">Raven.captureException(err,</span> <span style=\"color: #2eb0f7\">function</span> <span style=\"color: #111111\">(err,</span> <span style=\"color: #111111\">eventId)</span> <span style=\"color: #111111\">{</span>\n <span style=\"color: #111111\">console.log(</span><span style=\"color: #e8535a\">&#39;Reported error &#39;</span> <span style=\"color: #4b4f5c\">+</span> <span style=\"color: #111111\">eventId);</span>\n <span style=\"color: #111111\">});</span>\n<span style=\"color: #111111\">});</span>\n\n<span style=\"color: #111111\">app.listen(</span><span style=\"color: #45c2c9\">3000</span><span style=\"color: #111111\">);</span>\n</pre></div>\n</div>\n</div>\n",
  3. "link": "https://docs.getsentry.com/clients/node/integrations/koa/",
  4. "id": "node-koa",
  5. "name": "Koa"
  6. }