source: trip-planner-front/node_modules/karma/lib/middleware/stopper.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 517 bytes
Line 
1/**
2 * Stopper middleware is responsible for communicating with `karma stop`.
3 */
4
5const log = require('../logger').create('middleware:stopper')
6
7function createStopperMiddleware (urlRoot) {
8 return function (request, response, next) {
9 if (request.url !== urlRoot + 'stop') return next()
10 response.writeHead(200)
11 log.info('Stopping server')
12 response.end('OK')
13 process.kill(process.pid, 'SIGINT')
14 }
15}
16
17createStopperMiddleware.$inject = ['config.urlRoot']
18exports.create = createStopperMiddleware
Note: See TracBrowser for help on using the repository browser.