@vigilant-js/express
v1.0.10
Published
Express middleware for Vigilant
Maintainers
Readme
Vigilant Express
This is the Express middleware for Vigilant (https://vigilant.run).
Installation
npm install @vigilant-js/core @vigilant-js/expressGenerate a token
You can generate a token by going to the Vigilant Dashboard and clicking the "Create Token" button.
Usage (Middleware)
Vigilant Express provides two middleware functions:
addLoggingMiddleware- Logs all requests and responsesaddExceptionMiddleware- Logs all unhandled exceptions
Use these to monitor your Express application.
import { initVigilant } from '@vigilant-js/core'
import { addExceptionMiddleware, addLoggingMiddleware } from '@vigilant-js/express'
initVigilant({
name: 'backend',
token: 'generated-token-here',
})
addLoggingMiddleware(app)
app.get('/', (req, res) => {
res.send('Hello, world!')
})
addExceptionMiddleware(app)
app.listen(3000, () => {
console.log('Server is running on port 3000')
})