Socket
Book a DemoInstallSign in
Socket

cleanup

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cleanup

Cleanup handling for domains.

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

Cleanup -- cleanup handlers for domains

npm install cleanup

var cleanup = require('cleanup')

var domain = cleanup(function (error) {
  doDatabaseCleaning(function (e, success) {
    if (error) process.exit(1)
    server.close()
  })
})

domain.enter()

var server = http.createServer(function (req, resp) {
  doDatabaseQuery(function (e, message) {
    if (e) throw e
    resp.statusCode = 200
    resp.end('ok')
  })
})

server.listen(8080, function () {
  writeManyThingsToDatabase(function (e, i) {
    if (e) throw e
    request('http://localhost:8080', function (e, resp, body) {
      if (e) throw e
      assert.equal(resp.statusCode, 200)

      domain.cleanup()
    })
  })
})

Keywords

domains

FAQs

Package last updated on 15 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts