Node Package Master

    @appsignal/express
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.33 • Public • Published

    @appsignal/express

    npm (scoped) npm peer dependency version (scoped)

    The AppSignal for Node.js integration for Express.js (express) v4.0.0+.

    Installation

    First, sign up for an AppSignal account and add both the @appsignal/nodejs and @appsignal/express packages to your package.json. Then, run yarn install/npm install.

    You can also add these packages to your package.json on the command line:

    yarn add @appsignal/nodejs @appsignal/express
    npm install --save @appsignal/nodejs @appsignal/express

    You can then import and use the package in your app.

    Usage

    Middleware

    The module includes middleware for automatically instrumenting the routes of your application.

    const { Appsignal } = require("@appsignal/nodejs")
    
    const appsignal = new Appsignal({
      active: true,
      name: "<YOUR APPLICATION NAME>",
      pushApiKey: "<YOUR API KEY>"
    })
    
    const express = require("express")
    const { expressMiddleware } = require("@appsignal/express")
    
    const app = express()
    
    // ADD THIS AFTER ANY OTHER EXPRESS MIDDLEWARE, BUT BEFORE ANY ROUTES!
    app.use(expressMiddleware(appsignal))

    Error Handler

    The module also contains a middleware for catching any errors passed to next().

    const { Appsignal } = require("@appsignal/nodejs")
    
    const appsignal = new Appsignal({
      active: true,
      name: "<YOUR APPLICATION NAME>"
      pushApiKey: "<YOUR API KEY>"
    })
    
    const express = require("express")
    const { expressErrorHandler } = require("@appsignal/express")
    
    const app = express()
    
    // ADD THIS AFTER ANY OTHER EXPRESS MIDDLEWARE, AND AFTER ANY ROUTES!
    app.use(expressErrorHandler(appsignal))

    An example Express app, containing usage of all of our middleware and custom instrumentation can be found here.

    Contributing

    Thinking of contributing to this repo? Awesome! 🚀

    Please follow our Contributing guide in our documentation and follow our Code of Conduct.

    Also, we would be very happy to send you Stroopwafles. Have look at everyone we send a package to so far on our Stroopwafles page.

    Support

    Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

    Keywords

    none

    Install

    npm i @appsignal/express

    DownloadsWeekly Downloads

    2,774

    Version

    1.0.33

    License

    MIT

    Unpacked Size

    7.14 kB

    Total Files

    6

    Last publish

    Collaborators

    • as_unflxw
    • luismiramirez
    • matsimitsu
    • wesoudshoorn
    • jvanbaarsen
    • thijsc
    • tombruijn
    • jkreeftmeijer