Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
517 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /**
|
---|
| 2 | * Stopper middleware is responsible for communicating with `karma stop`.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | const log = require('../logger').create('middleware:stopper')
|
---|
| 6 |
|
---|
| 7 | function 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 |
|
---|
| 17 | createStopperMiddleware.$inject = ['config.urlRoot']
|
---|
| 18 | exports.create = createStopperMiddleware
|
---|
Note:
See
TracBrowser
for help on using the repository browser.