diff options
| author | Tibor Blenessy | 2020-01-13 11:44:34 +0100 |
|---|---|---|
| committer | GitHub | 2020-01-13 11:44:34 +0100 |
| commit | 13d52b7dd495c68c72ad8ab3f5063307bf42cfad (patch) | |
| tree | 057fd574afec4bd7f32283088c9fa2d8b8c66360 /sonar-css-plugin/css-bundle/src/server.ts | |
| parent | c0ba07e77931f187a788c7b1ab5420ead525e3d3 (diff) | |
| download | sonar-css-13d52b7dd495c68c72ad8ab3f5063307bf42cfad.tar.bz2 | |
Implement close endpoint to shutdown the Node.js process (#243)
Diffstat (limited to 'sonar-css-plugin/css-bundle/src/server.ts')
| -rw-r--r-- | sonar-css-plugin/css-bundle/src/server.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sonar-css-plugin/css-bundle/src/server.ts b/sonar-css-plugin/css-bundle/src/server.ts index 93bb6cb..e9c66c0 100644 --- a/sonar-css-plugin/css-bundle/src/server.ts +++ b/sonar-css-plugin/css-bundle/src/server.ts @@ -27,6 +27,13 @@ export function start(port = 0): Promise<Server> { resp.send("OK!") ); + app.post("/close", (_req: express.Request, resp: express.Response) => { + console.log("DEBUG stylelint-bridge server will shutdown"); + resp.end(() => { + server.close(); + }); + }); + // every time something is wrong we log error and send empty response (with 0 issues) // it's important to keep this call last in configuring "app" app.use( |
