Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* Create a mock http server
*/
http.createServer((req, res) => {
// Then mark it at every connections
meter.mark()
res.end('Thanks')
}).listen(5005)
/**
* Probe system #4 - Counter
*
* Measure things that increment or decrement
*/
const counter = io.counter({
name: 'Downloads'
})
/**
* Now let's create some remote action
* And act on the Counter probe we just created
*/
io.action('decrement', { comment: 'Increment downloads' }, (cb) => {
counter.dec()
cb({ success: true })
})
io.action('increment', { comment : 'Decrement downloads' }, (cb) => {
// Increment the previous counter
counter.inc()
cb({ success: true })