Express.js

The following is an example of how to use monitro with express.js, this is a simple example and not the best way to use monitro, but it should give you an idea of how to use it. app.ts

//app.ts
import express from 'express' 
import { Monitro } from 'monitro'

const app = express()
const monitroClient = new Monitro('monitro-dev', API_KEY, { hookExceptions: true })
const port = 3000

app.get('/', (req, res) => {
try {
  res.send('Hello World!')
}
catch(e){
    monitroClient.warn('Something Failed In /', 'Failed to send hello world', { error: e })
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
Monitro's cleint can be used anywhere in express.js but keep it on the server side, you can use this on the clients browser but it is NOT recomended as currently the API key has no protection to abuse, we plan on adding this in the future.
On this page