ưμ㼯a
请提供Next.js的路径,用于监测和管理您在生产中的应用.
灵感来自 rcruzper / 快动器 但适合Next.js的应用程序.
终点
| 身份证 | 说明 |
|---|---|
| 资讯 | 显示应用程序信息. |
| 计量 | 显示当前应用程序的计量信息. |
| 卫生 | 显示应用健康信息. |
安装
npm install --save @bueno-systems/next-actuator
# or
yarn add @bueno-systems/next-actuator
包含类型Script
使用量
创建文件于 ./pages/api/actuator/[...actuator].ts (或类似)和
返回一个呼叫 nextActuator()。有命名或默认的出口.
// ./pages/api/actuator/[...actuator].ts
import { nextActuator } from '@bueno-systems/next-actuator'
// Export the handler function with some options
export default nextActuator()
配置
nextActuator({
enableHealth: true, // enable/disable /health endpoint (default true)
enableMetrics: true, // enable/disable /metrics endpoint (default true)
enableInfo: true, // enable/disable /info endpoint (default true)
healthEndpoint: '/health', // change the /health endpoint to something else
metricsEndpoint: '/metrics', // change the /metrics endpoint to something else
infoEndpoint: '/info' // change the /info endpoint to something else
})
结束点示例
GET http://localhost:3000/api/actuator/health
{
"status": "UP"
}
GET http://localhost:3000/api/actuator/info
{
"build": {
"name": "My Cool Project",
"description": "Description from package.json",
"version": "1.2.3"
}
}
GET http://localhost:3000/api/actuator/metrics
{
"mem": {
"rss": 550682624,
"heapTotal": 244232192,
"heapUsed": 213942064,
"external": 191258086,
"arrayBuffers": 188265357
},
"uptime": 2642.679833583
}