{% load i18n %}

{% blocktrans with 'https://github.com/mattrobenolt/raven-node' as link %}Start by installing raven-node:{% endblocktrans %}

npm install raven

{% trans "Register an instance of the Connect middleware after your main application handler:" %}

connect(
  connect.bodyParser(),
  connect.cookieParser(),
  mainHandler,
  raven.middleware.connect('{% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}'),
).listen(3000);

{% trans "Ensure Node is run with NODE_ENV=production:" %}

NODE_ENV=production node script.js

{% trans "That's it! Raven automatically installs an error handling hook to pipe all uncaught exceptions to Sentry." %}

{% blocktrans with 'https://github.com/mattrobenolt/raven-node' as link %}For more information on other uses of Raven with Node.js, please see the official documentation for raven-node.{% endblocktrans %}