Skip to content

Commit

Permalink
add health check
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Dec 11, 2023
1 parent 3ab8d0c commit f01d390
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions demo-server/demo-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ const port = process.env.PORT || 3000
const staticServer = nostatic ? null : new StaticServer('../', { cache: production ? 3600 : false, gzip: production })

const server = http.createServer((request, response) => {
if (request.url === '/health') {
response.writeHead(200, { 'Content-Type': 'application/json' })
response.end(JSON.stringify({
response: 'ok'
}))
return
}

if (staticServer && !(request.url || '').startsWith('/ws/')) {
request.addListener('end', () => {
staticServer.serve(request, response)
Expand Down

0 comments on commit f01d390

Please sign in to comment.