Skip to content

gaogao1030/wrap-next-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme

Install

npm install wrap-next-handler

Usage

const wrapHandler = require('wrap-next-handler') // <- require this package

const packageInfo = require("./package.json")
const dev = process.env.NODE_ENV !== 'production'

const app = next({ dev })

const handle = wrapHandler(app) // <- pass app to wrapHandler
const port = process.env.PORT || 3200

app.prepare().then(() => {
    createServer((req, res) => {
        const parsedUrl = parse(req.url, true)
        handle(req, res, parsedUrl) // <- using this handler
    }).listen(port, err => {
        if (err) throw err
        console.log('> Ready on http://localhost:' + port)
    })
})

feature

  • support /metrics path for prometheus collect metrics
  • support /api/v1/healthz/status for livenessProbe in Deployment

About

kubernetes custome metrics hpa deploy for nextjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published