@byu-oit/express-profiler-middleware
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.1 • Public • Published

    Express Profiler Middleware

    An Express middleware function for profiling client requests using the v8 profiler (See v8-profiler-next).

    Usage Example

    const express = require('express')
    const profiler = require('@byu-oit/express-profiler-middleware')
    
    const app = express()
    
    app.use(profiler.middleware((req, profile) => {
      const fileName = `${Date.now().toString()}-${req.method}${req.path.split('/').join('-')}.cpuprofile`
      profile.export((error, result) => fs.writeFileSync(fileName, result))
    }))
    
    app.get('/xhealth', (req, res) => {
      setTimeout(() => res.sendStatus(200), 250)
    })
    
    let port = process.env.PORT || 8080
    app.listen(port, () => console.log(`Server listening on port ${port}`))

    Install

    npm i @byu-oit/express-profiler-middleware

    DownloadsWeekly Downloads

    1

    Version

    0.1.1

    License

    Apache-2.0

    Unpacked Size

    15.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • yoshutch
    • lehinpm
    • oscea
    • stuft2
    • pauldeden
    • mhailstone
    • gi60s
    • arasmus8
    • garygsc
    • byujol
    • martingarn
    • snelg
    • mzroth
    • byu-oit-bot